NHibernate. Join unrelated entities

后端 未结 3 2102
自闭症患者
自闭症患者 2021-01-22 16:34

Is there any way to execute following query with native NHibernate linq provider?

var result =
    (from e1 in Session.Query()
     join e2 in Se         


        
3条回答
  •  灰色年华
    2021-01-22 17:16

    Not using LINQ, but you can do theta joins when using HQL.

    Select e1.Id, e1.SomeField, e2.SomeUnrelatedField 
    from Entity1 e1, Entity2 e2  where e1.SomeField = e2.SomeField
    

    However, you won't be able to do outer joins with this. So if that's a requirement, you'll have to go with raw SQL.

提交回复
热议问题