left outer join using linq query syntax
var result = from p in _context.ParentTable<br/>
join c1 in _context.ChildTable1 <br/>on p.ID equals c1.ID into pc1Table <br/>from pc1Join in pc1Table.DefaultIfEmpty()<br/>
join c2 in _context.ChildTable2 on p.ID equals c2.ID into pc2Table from pc2Join in pc2Table.DefaultIfEmpty()
where (c1.columnname == "value1" ||
c2.columnname == "value2") && p.columnname == "value"
select new
{
pID = p.ID,
c1ID = c1.ID,
c2ID = c2.ID};
Comments
Post a Comment