Search code examples
nhibernatefluent-nhibernatenhibernate-mappinglinq-to-nhibernatefluent-nhibernate-mapping

Conditional fetching with NHibernate


I need to eager load an object tree with NHibernate but I also wish to specify which objects to load.

The object tree is like this:

class A {
   double Date;
   IList<B> Bs;
}

class B {
   double Date;
   IList<C> Bs;
}

class C {
   double Date;
}

And what I want to do, is to eager load the whole tree, where A.Date > 2012, B.Date > 2012, C.Date > 2012 (basicly I want only a snapshot of the object tree according to my specified constraints).

Is that possible ?

I'm using NH 3.1 and Fluent.

Thanks!


Solution

  • Have you tried with NHibernate Filters ? http://nhibernate.info/doc/nh/en/index.html#objectstate-filters