C# ResolutionContext.Items从Automapper 9.0引发异常
我尝试将我的解决方案从C# ResolutionContext.Items从Automapper 9.0引发异常,c#,automapper,C#,Automapper,我尝试将我的解决方案从AutomapperV8.1.1升级到AutomapperV9.0.0 但我面临一个问题 我有两个场景和一张地图。在第一个场景中,我将数据传递到解析上下文: attachments = _mapper.Map<Attachment[]>(objects.Items, opt => { opt.Items[Constants.IncludeDescription] = true; }); attachments=\u
Automapper
V8.1.1升级到Automapper
V9.0.0
但我面临一个问题
我有两个场景和一张地图。在第一个场景中,我将数据传递到解析上下文:
attachments = _mapper.Map<Attachment[]>(objects.Items, opt => {
opt.Items[Constants.IncludeDescription] = true;
});
attachments=\u mapper.Map
Automapper V8.1.1:
对于Automapper
8.1.1来说,一切正常,但版本9.0.0
上下文。项目抛出一个系统。InvalidOperationException
(见上图),所以我不确定这是否是一个bug。正如@Lucianbagoanu在9.0.0中注意到的那样,我们需要提供{所以resolutionContext.Items不会抛出异常。您必须按照消息所说的去做。
attachments = _mapper.Map<Attachment[]>(objects.Items);`