tags:

views:

16

answers:

1

This is my query:

Dim bugs = (From b In bugCon.bugs Where sctUserIds.Contains(b.Developer.Value) Order By b.bg_id Select Bug = b, Project = b.project).ToList

Currently this does an inner join between "bugs" and "projects". How do I turn it into a left join?

A: 

I haven't tested this, but the query below should get you headed in the right direction. The key is the join ... into syntax and the use of DefaultIfEmpty()

from b in context.Bugs
join p in context.Projects
on b.projectID equals p.projectID into BugProjects
where sctUserIds.Contains(b.Developer.Value)
from bugProjects in BugProjects.DefaultIfEmpty()
select new {
  Name = p.Name,
  ...
  BugProjects = bugProjects
}
Rob