I'm trying to optimize an NHibernate query:
var profile = dc.Profiles.FirstOrDefault(p => p.IdProfile == idProfile);
I would like it to load a collection of Rights. I did this:
var profile = dc.Profiles.Fetch(x => x.Rights).FirstOrDefault(p => p.IdProfile == idProfile);
The results were totally different from what I expected - instead of getting single Profile with rights I got single profile with single right!
How can I fix it?
> U can even make grouping `var profile = from profile in dc.Profiles where profile.Right == right group profile by profile.Rights into grp select grp.FirstOrDefault(); – Vitthal Mar 15 '13 at 12:33