本文介绍了ValueInjecter - 加入多个结果集为1集LINQ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用ValueInjecter与LINQ联接连接多个结果集?例如,该code注射结果值到 CombinedResult 的对象,但我也想了一些 errorsAndWarning 值到 CombinedResult 。属性具有相同的名称:

How do I use ValueInjecter with a LINQ join that joins multiple result sets? For example, this code inject result values into CombinedResult object, but I also want some of errorsAndWarning values into CombinedResult. The properties have the same name:

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;

感谢。

推荐答案

使用这样的:

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;

这篇关于ValueInjecter - 加入多个结果集为1集LINQ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-11 01:59