I found several resources on the internet, but havent really been able to sort this
I basically have a query that has two left members.
var query = session.QueryOver<NewsPost>(() => newsPostAlias) .Left.JoinQueryOver(x => newsPostAlias.PostedBy, () => userAlias) .Left.JoinQueryOver(x => newsPostAlias.Category, () => categoryAlias) .Fetch(x => x.PostedBy).Eager .Fetch(x => x.Category).Eager .Where(x => !x.Deleted);
This may not be the right way to do this, but it does not seem to break. Now what I want to do is two tables that left links to exits. I want the Deleted column in both of these tables to be false.
However, whenever I add this restriction, the results are returned only when the foreign key column in the newsletter is filled, but since this value is null, and why I made it a left member, this is not desirable.
What is the best way to basically do this
.Where(x => !x.Deleted && !x.PostedBy.Deleted && !x.Category.Deleted);
I studied variety, futures and disjunctions, I'm not sure which approach should be taken, obviously, I can think of several ways (as my gut tells me) about how to do this, but right? :)
thanks
EDIT - Modify the accepted answer
return session.QueryOver(() => newsPostAlias) .Fetch(x => x.PostedBy).Eager .Fetch(x => x.Category).Eager .Left.JoinQueryOver(() => newsPostAlias.PostedBy, () => postedByAlias) .Left.JoinQueryOver(() => newsPostAlias.Category, () => categoryAlias) .Where(() => !newsPostAlias.Deleted) .And(() => newsPostAlias.PostedBy == null || !postedByAlias.Deleted) .And(() => newsPostAlias.Category == null || !categoryAlias.Deleted) .OrderBy(() => newsPostAlias.PostedDate).Desc .Take(10) .List();