首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

linq left join 多条件如何写

2012-02-09 
linq left join 多条件怎么写?select a.*,b.* from aleft join b on a.type b.type and a.item b.item

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应该怎么写?谢谢!

热点排行