Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 具有多连接的NHibernate条件子查询_C#_Hibernate_Join_Subquery_Criteria - Fatal编程技术网

C# 具有多连接的NHibernate条件子查询

C# 具有多连接的NHibernate条件子查询,c#,hibernate,join,subquery,criteria,C#,Hibernate,Join,Subquery,Criteria,有人知道如何对以下情况进行条件查询吗 我有两门课: classA { int Id; string name; string surname; string myproperty; classB classbId; } classB { int Id; string property1value; string property2value; } 有一个SQL查询: SELECT a0.name, a0.surname, (SE

有人知道如何对以下情况进行条件查询吗

我有两门课:

classA
{
    int Id;
    string name;
    string surname;
    string myproperty;
    classB classbId;
}

classB
{
    int Id;
    string property1value;
    string property2value;
}
有一个SQL查询:

SELECT a0.name,
a0.surname,
(SELECT a2.myproperty from classB b1
inner join classB b2 on b1.property1value= b2.property2value
inner join classA a1 on b1.Id = a1.classbId
inner join classA a2 on b2.Id = a2.classbId
where a1.Id = 7) as subSelect

FROM classA a0
where a0.Id = 7
项目定义如下:

ProjectionList proj = Projections.ProjectionList();
我需要的是创建如下内容:

DetachedCriteria subqueryCriteria = DetachedCriteria.For(typeof(???))
.SetProjection(Projections.Property("a2.myproperty"))
?????
?????
然后将其添加到项目中:

proj.Add(Projections.SubQuery(subqueryCriteria), "MyProperty");
因此,我可以将其添加到目前的主查询中:

.CreateCriteria<'classA>("a0")
.CreateAlias("classB", "b0", JoinType.InnerJoin)
.SetProjection(proj)
但这并不重要,问题是:如何翻译子选择以便它可以工作? 谢谢你的帮助

proj.Add(Projections.Property(name/surname));