首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Linq中的右连接,未返回正确的值

Linq中的右连接,未返回正确的值
EN

Stack Overflow用户
提问于 2017-05-09 04:34:28
回答 1查看 61关注 0票数 0

我正在尝试构建这个linq查询,但遇到了一些问题

我有两个列表

房间,包含Id,Name,RoomStatus,OrderStatus,ConsructionType

STRINGMAP,包含AttributeName、AttributeValue、Value

代码语言:javascript
复制
var stringMap = from sm in _CRMcontext.StringMaps
                where sm.ObjectTypeCode == 10001 
                && sm.AttributeName == "new_status" 
                || sm.AttributeName == "new_projecttype" 
                || sm.AttributeName == "new_orderstatus" 
                || sm.AttributeName == "new_construction_type" 
                || sm.AttributeName == "new_stage"
                select sm;

var result = from set in ROOMS
             join roomStatus in stringMap on set.Status equals status.AttributeValue
             where roomStatus.AttributeName == "new_status"
             join orderStatus in stringMap on set.OrderStatus equals orderStatus.AttributeValue
             where orderStatus.AttributeName == "new_orderstatus"
             join consructionType in stringMap on set.ConstructionType equals consructionType.AttributeValue
             where consructionType.AttributeName == "new_construction_type"
             select new DTO.Shared.Project() {
                 Id = set.Id,
                 Name = set.Name,
                 RoomStatus = roomStatus.Value,                 
                 OrderStatus = orderStatus.Value,
                 ConstructionType = constructionType.Value,
                 };

因此,我只返回连接中没有null的结果,我希望无论null如何,都要返回它们,这类似于sql中的右连接

谢谢,迈克尔

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43856834

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档