I've looked all over at different topics on this and I'm still having problems.
I'm trying to perform a left outer join with linq. I'm not having any luck. Here's my code:
Code:
var query = dataContext.Title.Where(
t => t.JobID == jobID && dataContext.EstimateRequestTitle.Any(ert => ert.TitleID == t.TitleID));
var query2 = query.DefaultIfEmpty()
.Join(dataContext.EthicalCategory.DefaultIfEmpty() , t => t.EthicalCategoryID, ec => ec.EthicalCategoryID,
(t, ec) =>
new
{
t.ISBN,
t.TitleID,
t.TitleName,
t.EthicalCategoryID,
EthicalCategoryName = ec.CategoryName,
ec.AccreditingBodyID
}).DefaultIfEmpty();
As you can see, I've ended up adding DefaultIfEmpty ALL OVER the place and yet query2 still doesn't contain any records when query does. No matter what I do, the sql it produces always contains at least one inner join.
Can anyone help?