簡體   English   中英

來自靜態的AutoMapper非靜態轉換-MapperConfiguration,CreateMapper

[英]AutoMapper non-static conversion from static - MapperConfiguration, CreateMapper

我正在從混合使用.NET Framework 4的v2和v4 AutoMapper靜態編碼,過渡到使用.NET Framework 4.6.2的6.0.1版本。 我在Visual Studio 2015下進行轉換開發時遇到問題。

var dummy = new MapperConfiguration(cfg => cfg.CreateMap<DateTime,string>());

Visual Studio告訴我MapperConfiguration.MapperConfiguration(Action <IMapperConfigurationExpression> configure)(+ 1重載)構造函數“ MapperConfiguration”具有0個參數,但使用1個參數調用。

當我編寫下一行代碼時:

var dmy1 = dummy.CreateMapper();

Visual Studio告訴我IMapper MapperConfiguration.CreateMapper()(+ 1重載)無法解析符號CreateMapper。

這些都是基本的非靜態內容,我可以用另一雙眼睛讓我抬起頭來了解我所缺少的內容。 我在想,一旦我用第一行代碼解決了問題,其他問題就會消失。 想法?

當我重新啟動Visual Studio時,問題消失了。 VS實例中一定有一些殘留物會引起問題。

更新Edmx之后,我遇到了同樣的問題。 在Visual Studio重新啟動后,問題消失了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM