Tuesday, September 22, 2009

Left Join, Right Join Using LINQ

How we can handle a trouble when passing a left or Right join within the context of Linq?

var LeftJoin = from t1 in Table1
join t2 in table2
on t1.ID equals t2.ID into JoinedT
from T2 in JoinedT .DefaultIfEmpty()
select new
{
T1 = T1.Name,
T2 = description
};


to make the same to Right join just invert the side of the Join

No comments: