Hello,
I am trying to create an outer join in Linq using DefaultIfEmpty. It does not seem to be working. Basically I want c.TotalAmount to be 0 if it does not exist in the second/right table. Any ideas as to what I might be doing wrong? The query does execute, but it seems to still work as an innner join. I do not get any results where the join fails. Thanks very much.
var rtaloBySystem = (from r in RTLO
from c in contractCoverageBySystem.DefaultIfEmpty()
where r.System_ID == c.System_ID && r.Month == c.Month && r.Year == c.Year
select new Allocator() {Month = r.Month, Year = r.Year, System_ID = r.System_ID, Amount = r.Amount - (c.TotalAmount == null ? 0 : c.TotalAmount)}).ToArray();