开发者

JoinQueryOver with multiple tables with NHibernate

开发者 https://www.devze.com 2023-03-23 10:53 出处:网络
I can\'t build the lambda expressions in NHibernate JoinQueryOver that solve the SQL c开发者_Python百科ommand below:

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[]>();
0

精彩评论

暂无评论...
验证码 换一张
取 消