流畅的 nHibernate Restrictions.Not 似乎无法正常工作

fluent nHibernate Restrictions.Not seems not be working properly

我有协会:

TableA 1 --- * TableB 

我尝试构建一个查询,其中 returns 我是 TableA 项的列表,其所有项 (TableB) 在列 [=15= 中都有一个值] 和 Y。但该查询似乎忽略了 not null condition in the X and Y column,为什么?

或者,如何重建该查询,也许可以使用子查询?

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>();

使用子查询过滤掉 tabB-Items 中具有空值的 TableA 元素

var subquery = QueryOver.Of<TableA>()
    .JoinQueryOver(tabA => tabA.TableBItems)
        .Where(tabB => tabB.X == null || tabB.Y == null)
    .Select(Projections.Id());

var s = Session.QueryOver<TableA>()
    .Where(tabA => tabA.SomeID == 123 && tabA.SomeNullableDate != null)
    .WhereRestrictionOn(Projections.Id()).NotIn(subquery)
    .JoinQueryOver(tabA => tabA.TableBItems)
        .Where(tabB => tabB.X != null && tabB.Y != null)
    .List<TableA>();