NHibernate 3.0 equivalent of QueryOver for FetchMany in Nhibernate Linq

The linq provider in Nhibernate 3 gives me the opportunity to specify the desired selection of several levels for collections using FetchMany, ThenFetchMany, etc. Is there an equivalent way to do this with QueryOver.

Say I have a structure

class A { IList<B> b; } class B { IList<C> c; } class C { } 

I can load the whole tree in NH Linq

 session.Query<A> .FetchMany(x=> ab) .ThenFetchMany(y => yc) .ToList(); 

Is there a way to do this using the QueryOver api?

+4
source share
2 answers

I really asked the same question here on SO, and posted the answer I found.

+2
source
 B bAlias = null; C cAlias = null; var list = session.QueryOver<A> .JoinAlias(x=>xb, () => bAlias, JoinType.LeftOuterJoin) .JoinAlias(x=>bAlias.c, () => cAlias, JoinType.LeftOuterJoin) .List(); 
0
source

Source: https://habr.com/ru/post/1338255/


All Articles