I have the next Fluent NHibernate query using QueryOver:
IQueryOver<Task> query = session
.QueryOver<Task>()
.JoinAlias(x => x.Subject, () => subject, JoinType.LeftOuterJoin)
.JoinAlias(() => subject.Localizations, () => localization, JoinType.LeftOuterJoin)
.Where(() => localization.Language.Id == languageId || localization.Language.Id == null);
.Where(x => x.UserId == userId)
This performs the next query:
SELECT * FROM Tasks left outer join Subjects on Tasks.SubjectId = Subjects.IdAsignatura
left outer join Languages on Subjects.SubjectId=Languages.SubjectId
WHERE Tasks.UserId = xxx
and (Languages.LanguageId = yyy or Languages.LanguageId = is null)
I would like to avoid the last line using "LEFT OUTER JOIN ... AND" like this:
SELECT * FROM Tasks left outer join Subjects on Tasks.SubjectId = Subjects.IdAsignatura
left outer join Languages on Subjects.SubjectId=Languages.SubjectId AND Languages.LanguageId = yyy
WHERE Tasks.UserId = xxx
Is there a way to perform "LEFT OUTER JOIN ... AND" Fluent NHibernate queries?