您的位置:首页 > 其它

EF 查询表数据,如果查询外键表,且这个外键有可能为空,但主表资料也就查不出来的解决方法

2013-08-20 10:53 281 查看
var items = from x in ctx.MES_Entity_RegisterMeasureES

join y in ctx.MES_Code_TypesFieldProduct on x.ProductTypeCode equals y.ProductTypeCode

into temp

from tt in temp.DefaultIfEmpty()

join z in ctx.MES_Entity_RegisterProductionUnits on x.ProductionUnitID equals z.ProductionUnitID

into temp1

from bb in temp1.DefaultIfEmpty()

select new RegisterMeasureESModel() { ProductionUnitName = bb.ProductionUnitName ,

ProductType=tt.ProductType };
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐