我试图找出LINQ多个左连接的语法,但我收到错误:The name 'c' is not in scope on the left side of 'equals'. Consider swapping the expressions on either side of 'equals'.
我已经尝试过交换,如果我这样做,它会使'c'和'd'都有"not in scope"错误.
var result =
from a in db.tableA
join b in db.tableB //first join (inner join)
on a.field1 equals b.field1
join c in db.tableC //second join (left join)
on a.field1 equals c.field1
into left_one
join d in db.tableD //third join (left join)
on c.field2 equals d.field2
// ^ here
into left_two
where a.field1 …Run Code Online (Sandbox Code Playgroud)