0%

Linq 外连接

记录一下linq外连接写法

1
2
3
4
5
6
7
8
var result = from a in OverViewInfo
join city in Orgs on a.CityId equals city.Id into gcity
from kcity in gcity.DefaultIfEmpty()
join mcountry in Orgs on a.CountyId equals mcountry.Id into gcounty
from kcounty in gcounty.DefaultIfEmpty()
select new { a,kcity,kcounty};

result.Dump(); //linqPad调试