I'm using NHibernate with FluentNH. I've a simple class called PostCategory and it contains a collection of Posts. The PostCategory class contains a property called TotalActivePosts. When I load all the PostCategories I want the no. of active posts for each category to be populated in this property. How I can do that? Any help is greatly appreciated.
Vijaya Anand
The way I did it is by using a computed property. see item no. 5- arbitrary SQL.
you could use something like:
Select Count(*) from Posts where PostCategoryId = Id And IsActive = 1
see also this question
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With