Reputation: 51927
I'm building a dynamic query and doing a join between 2 entities: the query being built and a table.
I have:
var TheQuery = ...;
TheQuery = from x in TheQuery
join c in MyDataContext.TheTable on
x.ID equals c.ID
where "there's no matching element in TheTable"
select x
Thanks for your suggestions.
Upvotes: 0
Views: 58
Reputation: 160862
To do a Left outer join with LINQ you have to use join .. into
and DefaultIfEmpty()
:
TheQuery = from x in TheQuery
join c in MyDataContext.TheTable on x.ID equals c.ID into outer
from o in outer.DefaultIfEmpty()
where o == null
select x
Upvotes: 2