如何将ValueInjecter与连接多个结果集的LINQ连接一起使用?例如,此代码会将result
值注入CombinedResult
个对象,但我还希望将errorsAndWarning
个值转换为CombinedResult
。这些属性具有相同的名称:
var combined = from result in results.DeferredItems
join errorsAndWarning in errorsAndWarnings.DeferredItems
on result.MeetingID equals errorsAndWarning.MeetingID
select new CombinedResult().InjectFrom(result) as CombinedResult;
感谢。
答案 0 :(得分:3)
使用此:
var combined = from result in results.DeferredItems
join errorsAndWarning in errorsAndWarnings.DeferredItems
on result.MeetingID equals errorsAndWarning.MeetingID
select new CombinedResult().InjectFrom(result)
.InjectFrom(errorsAndWarning)
as CombinedResult;