Inner Join 在Linq中的写法如下:
var results = from f in db.Farms
join fc in db.FarmCategories on f.FarmId equals fc.FarmId where f.FarmId.Equals(2) select f;
Left Join 在Linq中的写法如下,后⾯使⽤ DefaultIfEmpty()
var results = from f in db.Farms
join fc in db.FarmCategories.DefaultIfEmpty() on f.FarmId equals fc.FarmId where f.FarmId.Equals(2) select f;
因篇幅问题不能全部显示,请点此查看更多更全内容