hi! you can try querying for just those children, like so:
var parents = QueryOver.Of<Parent>().WhereRestrictionOn(p => p.Id).IsIn(parentIds).Select(p=>p.Id); session.QueryOver<Child>().Where(c=> c.Prop < 10).WhereProperty(c=>c.ParentId).In(parents).List(); or you can try a filter. http://nhforge.org/wikis/reference2-0en/chapter-15-filtering-data.aspx i would do the former, maybe arrange results in some projection.. On Oct 20, 5:44 pm, Don <[email protected]> wrote: > Hi all, > > I'd like to know if there's a way to have NHibernate filters the > entities that can be lazy loaded for child collections using the LINQ > provider. This is similar to the functionality provided by LINQ-to- > SQL's DataLoadOptions.AssociateWith. Let's say for a given session > that I am going to load some ParentType entities, and only want the > related ChildType entities that have some property less than ten: > > ISession session = sessionFactory.openSession(); > session.AssociateWith<ParentType>(p => p.Children.Where(c => > c.Property < 10)); > IQueryable<ParentType> parents = nhSession.Query<ParentType>(); > > if(parents.Any(p => p.Children.Any(c => c >= 10))) throw new > Exception("Child with property >= 10!"); > > I'd like to be able to filter the data coming back through the > business logic layer without requiring the display layer to remembers > which children should be displayed and which shouldn't. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
