Hi All,

Is there someone who could explain to me how do I do a query to
retrieve a structure like the following:

(A)  1 -> M  (B)  M -> 1 (C)

The Entitties A, B; and C are related with these to one to many
relations. My intention is to retrieve a tree for one A with B and C
eagerly fetched in one query I would have done this with a Criteria as
follows:

pageList = session.CreateCriteria(typeof(A))
    .CreateAlias("BSet", "b", JoinType.LeftOuterJoin)
    .CreateAlias("b.C", "c", JoinType.LeftOuterJoin)
    .List<A>();

I have tried to query like following but is only getting an exception
with an error message telling me this:
Unable to cast object of type
'System.Linq.Expressions.ConstantExpression' to type
'System.Linq.Expressions.LambdaExpression'.

var many_a = from a in db.ASet
                    from c in db.CSet
                    from b in c.BSet
                    where b.A == a
                    select a;
aList = many_a.ToList();

/Mats

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to