linqjoin 多个表
大家帮我看看这个sql怎么写成linq的表达式,先谢谢了!
sql= "select * from a inner join b on a.bId = b.id
inner join c on on c.aId = a.id and b.id = c.bId
inner join d on c.dId = d.id
where c.id > 0"
尤其标红字体的那句不知道该怎么写,请大家帮忙
------解决方案--------------------
var query=from a1 in db.a
join b1 in db.b on a1.bId equals b1.id
join c1 in db.c on new {c1.aId,c1.bId} equals new {a1.id,b1.id}
join d1 in db.d on c1.dId equals d1.id
where c1.id>0
select new {a1,b1,c1,d1};