日期:2014-05-20  浏览次数:21199 次

linq left join 多条件怎么写?
select a.*,b.* from a 
left join b on a.type = b.type and a.item = b.item
where b.num > 3


请问转成linq应该怎么写?谢谢!

------解决方案--------------------
数据库中的可空可以映射为int?
from a in A join b in B.DefaultIfEmpty()
on new{a.type,a.item} equals new{b.type, b.item}
where a.num > 3
select new{Type = a.type==0 ? 100 : a.type, ...,a, b} 
可空类型直接用 ??
------解决方案--------------------
探讨
select a.*,b.* from a
left join b on a.type = b.type and a.item = b.item
where b.num > 3


请问转成linq应该怎么写?谢谢!