LINQ: Left Outer Join With LINQ to Entity

In LINQ every join you made is by default Inner Join. To perform the Left Outer Join you can do like below:

from mem in ctx.Member
join dist in ctx.District on mem.district_id equals dist.district_id
into jointDist
from dist in jointDist.DefaultIfEmpty()
select new StagingClass
{
 member_id = mem.member_id,
 district_name = dist.district_name
}

Comments

Popular posts from this blog

LINQ: Using int.TryParse() within a LINQ where clause

ASP.Net MVC: Configuring asp.net session state in SQL Server.

IIS: Publish Project to remote IIS with Web Deploy.