等于 NHibernate ICriteria/QueryOver 查询外连接中的条件

Equals conditions in outer joins with NHibernate ICriteria/QueryOver query

如何在 Nhibernate/QueryOver/ICriteria 的外部联接中执行 equals 条件?

我发现将 surveyRequest.Survey.Id 与下面的 surveyID 进行比较的唯一方法是与 IsIn 进行比较。

SystemUser systemUser= null;
SurveyRequests surveyRequest = null;

var query = Session.QueryOver<SystemUser>(() => systemUser)
    .Left.JoinAlias(
        () => systemUser.SurveyRequests, 
        () => surveyRequest,
        Restrictions.On(()=>surveyRequest.Survey.Id).IsIn(new object []{surveyID }))
//                                                   ^^^^

(我正在重复使用之前的 query question。)

我们可以使用 Restrictions

.Where() 部分
var query = Session.QueryOver<SystemUser>(() => systemUser)
    .Left.JoinAlias(
        () => systemUser.SurveyRequests, 
        () => surveyRequest,
        //Restrictions.On(()=>surveyRequest.Survey.Id).IsIn(new object []{surveyID }))
        Restrictions.Where(()=>surveyRequest.Survey.Id == surveyID ))