是否有一种简单的方法可以执行以下Nhibernate Linq语句
var query = from r in myTable.Query<MyTable>()
where r.Child == null
select r
上面的linq查询产生类似于
的内容SELECT MyTable.Id FROM MyTable WHERE MyTable.ChildId is null
它不引用子表并检查左连接是否为空,如下所示
SELECT MyTable.Id FROM MyTable
LEFT JOIN ChildTable ON MyTable.ChildId = ChildTable.Id
WHERE ChildTable.Id is null
答案 0 :(得分:1)
var query = from r in myTable.Query<MyTable>()
where r.Child.Id == null
select r