NHibernate 3.0 QueryOver equivalent of the FetchMany in Nhibernate Linq
-
28-10-2019 - |
문제
The linq provider in Nhibernate 3 gives me the ability to specify eager fetching of multiple levels for collections using FetchMany, ThenFetchMany etc. Is there an equivalent way of doinf this using QueryOver.
Say I have a structure
class A
{
IList<B> b;
}
class B
{
IList<C> c;
}
class C
{
}
I can eager load the whole tree in NH Linq
session.Query<A>
.FetchMany(x=> a.b)
.ThenFetchMany(y => y.c)
.ToList();
Is there a way of doing this using the QueryOver api?
해결책
I've actually asked the exact same question here on SO, and posted the answer that I found.
다른 팁
B bAlias = null;
C cAlias = null;
var list = session.QueryOver<A>
.JoinAlias(x=>x.b, () => bAlias, JoinType.LeftOuterJoin)
.JoinAlias(x=>bAlias.c, () => cAlias, JoinType.LeftOuterJoin)
.List();
제휴하지 않습니다 StackOverflow