Thanks Ricardo. I'm not sure how to make this work for multiple items 
though. I would like to get a mapping of Foo ids to the counts of 
associated Bars in one query, i.e.:

 --------------------
| Foo ID | Bar count |
|--------------------|
| abc123 |     5     |
| def456 |    15     |
 --------------------

My workaround for now is to map the FooBar join table even though no other 
mapping refers to FooBars, but it seems a bit ugly so I'm still looking for 
a better solution.

Dave

On Wednesday, February 4, 2015 at 10:27:03 PM UTC-7, Ricardo Peres wrote:
>
> For an individual entity, it is easy: 
>
> var foo = session.Get<Foo>(id); 
> var count = session.CreateFilter(foo.Bars, "select 
> count(*)").UniqueResult<int>(); 
>
> Not sure if this is what you wanted, though. 
>
> RP

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to