开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜