NHibernate 3. Alternatives to "ThenFetch" in QueryOver -


i'm using nhibernate 3.0 both linq provider , queryover. want eager load related data, , there comes method "fetch" rescue, both in linq , queryover. have special scenario want eager load property not directly on second level, like:

foo f = ...; f.a.b.c 

with linq there's no problem, can "chain" fetches method "thenfetch", like:

var result = session.query<foo>().fetch(a => a.a).thenfetch(b => b.b).thenfetch(c => c.c).tolist(); 

in queryover there's no such method, how can achieve same result?

thanks in advance.

i managed solve problem using 2 different approaches:

approach one:

session.queryover<foo>().fetch(x => x.a).fetch(x => x.a.b).fetch(x => x.a.b.c) 

approach two:

a = null; b b = null; c c = null;  session.queryover<foo>()     .joinalias(x => x.a, () => a)     .joinalias(() => a.b, () => b)     .joinalias(() => b.c, () => c) 

both work (altough i'm not sure if 1 of them generated "inner" , other 1 "outer" joins).


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -