I'm trying to get nhibernate to use a alias in a eager fetch. Im not sure its possible.
I'm trying to use the alias (bAlias in my example) in my fetch.
QueryOver<A>()
.JoinAlias(x => x.B, () => bAlias)
.JoinAlias(x => x.B, () => bAlias2)
.Where(() => bAlias2.Surname == "Smith")
.Fetch(() => bAlias).Eager
.Fetch(() => bAlias.C).Eager;
As you can see the fetch commands are using the 2 alias's instead of the direct path from .
The above code doesn't work. The code that does work is
QueryOver<A>()
.JoinAlias(x => x.B, () => bAlias)
.JoinAlias(x => x.B, () => bAlias2)
.Where(() => bAlias2.Surname == "Smith")
.Fetch(x => x.B).Eager
.Fetch(x => x.B.C).Eager;
As you can see its the Fetch statements that are different.
JoinAlias? - Andrew Whitaker