开发者

How can i perform this query in NHibernate for getting child count

开发者 https://www.devze.com 2023-01-12 01:36 出处:网络
select name, (select count(*) from products where products.category_Id=categories.Id) as productCount
select name, 
(select count(*) from products where products.category_Id=categories.Id) as productCount
from categories

session.CreateCriteria<Category>()

but whats next?

i don't even know how to search i开发者_开发知识库t in Google?


think of your query like

SELECT     categories.Id, count(categories.Id)
FROM         categories inner join products on products.category_Id=categories.Id
group by categories.Id

I think they will produce the same result.

search google for

nhibernate criteria join

and

CreateAlias

0

精彩评论

暂无评论...
验证码 换一张
取 消