我正在尝试构建这个linq查询,但遇到了一些问题
我有两个列表
房间,包含Id,Name,RoomStatus,OrderStatus,ConsructionType
STRINGMAP,包含AttributeName、AttributeValue、Value
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中的右连接
谢谢,迈克尔
https://stackoverflow.com/questions/43856834
复制相似问题