开发者

Selecting count of child object collection in NHibernate

开发者 https://www.devze.com 2022-12-12 03:05 出处:网络
I have a Customer object that has a child Orders collection.I have this relationship set up in the mapping file with Orders being laz开发者_开发知识库y-loaded.Is it possible to lazy-load only the coun

I have a Customer object that has a child Orders collection. I have this relationship set up in the mapping file with Orders being laz开发者_开发知识库y-loaded. Is it possible to lazy-load only the count of Orders instead of the entire collection? If so, how?

Thanks!


maybe you could try using a formula (see nhibenate mapping reference) to execute sql code and get the value directly into a property. this could use the count() function of your rdbms which avoids loading the entities at all.

0

精彩评论

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