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.

Reply via email to