How do I do a equals condition in an outer join in Nhibernate/QueryOver/ICriteria?
The only way I have found to compare surveyRequest.Survey.Id
with surveyID
below is with 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 }))
// ^^^^
(I am reusing an earlier query question.)
We can use the .Where()
part of Restrictions
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 ))