How to make LEFT JOIN in Lambda LINQ expressions
c#, entity-framework, linq
Solution
And this is the more complicated way using lambda expressions to write it:
order.Items
.GroupJoin (
productNonCriticalityList,
i => i.ProductID,
p => p.ProductID,
(i, g) =>
new
{
i = i,
g = g
}
)
.SelectMany (
temp => temp.g.DefaultIfEmpty(),
(temp, p) =>
new
{
i = temp.i,
p = p
}
)
Problem
How to make this expression as LEFT JOIN ``` var query = order.Items.Join(productNonCriticalityList, i => i.ProductID, p => p.ProductID, (i, p) => i); ```