JoinQueryOver with multiple tables with NHibernate
I can't build the lambda expressions in NHibernate JoinQueryOver that solve the SQL c开发者_Python百科ommand below:
SELECT
A.STATUS,
B.NUMBER,
B.OTHER_NUMBER,
A.Date01,
A.Date02
FROM
B,
C,
A
WHERE
A.ID = C.ID
AND B.ID = C.ID
All tables in SQL command above are in Entities with same name (A, B, C) and the inner join is in WHERE clause.
How can I build the NHibernate lambda query?
Thanks,
Roosevelt
A a = null;
B b = null;
var result = session.QueryOver<C>()
.JoinAlias(c => c.A, () => a)
.JoinAlias(c => c.B, () => b)
.Select(c => a.Status, c => b.Number, c => b.Other_Number, c => a.Date01, c => a.Date02 )
.List<object[]>();
精彩评论