Previously there was no simple solution for left or right join. We had to use DefaultIfEmpty or GroupJoin and SelectMany.
With DefaultIfEmpty():
var customerOrders = await (
from c in ctx.Customers
join o in ctx.Orders on c.CustomerId equals o.CustomerId into orders
from o in orders.DefaultIfEmpty()
select new {
c.CustomerId,
c.CustomerName,
OrderId = o == null ? 0 : o.OrderId
}
).ToListAsync();
I have used the way described above in most of my career. It was really hard to remember that syntax and I always struggled with that.
[Read More]

