Fluent nhibernate Nhibernate查询超过subquery
我有一个分离的查询,它投影两个字段:Fluent nhibernate Nhibernate查询超过subquery,fluent-nhibernate,nested,queryover,Fluent Nhibernate,Nested,Queryover,我有一个分离的查询,它投影两个字段: var detached = session.QueryOver.Of<ClassA>(). select ( Projections1.....X Projections2.....Y ) var result = session.QueryOver<ClassB>() .WithSubquery .WhereProperty
var detached = session.QueryOver.Of<ClassA>().
select
(
Projections1.....X
Projections2.....Y
)
var result = session.QueryOver<ClassB>()
.WithSubquery
.WhereProperty(p => p.X)
.In(detached)
.List();
我想要的是在嵌套部分中有两个字段,但是我如何在where属性中添加两个字段呢???我不认为您可以直接使用SQL来实现这一点,可以吗?如果你不能,使用QueryOver肯定是不可能的。我在上面写过,select是完全有效的,但不是在parten中,因为QueryOver不能在…中生成
(a.x,a.y)
QueryOver和ICriteria都应该能够在字段上分组,而不会自动投影字段。有时,您可能希望对字段进行分组,并从组中找到的实体中选择最新的实体。这是不可能的,而且很烦人
select * from tableA a
where (a.x, a.y) in (select x, y from tableB b)