0
我有关联关系:功能NHibernate Restrictions.Not似乎不能正常工作
TableA 1 --- * TableB
我尝试建立一个查询,返回我TableA
项目,其所有(TableB
)的列表中有值在列X
和Y
。但是这个查询似乎忽略了那个,为什么?
或者,如何重建该查询,也许玩子查询?
TableA tabA = null;
TableB tabB = null;
var s = Session.QueryOver<TableA>(() => tabA)
.JoinAlias(() => tabB.TableBItems,() => tabB, JoinType.InnerJoin)
.Where(Restrictions.Conjunction()
.Add(() => tabA.SomeID == 123)
.Add(() => tabA.SomeNullableDate != null)
)
.Where(Restrictions.Not(
Restrictions.Conjunction()
.Add(() => tabB.X == null)
.Add(() => tabB.Y == null)
))
.List<TableA>();