This article is a mirror article of machine translation, please click here to jump to the original article.

View: 21588|Reply: 0

[Source] AutoMapper type conversion error solution

[Copy link]
Posted on 6/14/2017 2:24:44 PM | | | |


I want to convert the int type to a string type, the code is as follows:

However, the error !! The reasons for the error are as follows!

Error CS0121 Calls between the following methods or properties are ambiguous: "IMappingExpression<TSource, TDestination>. ConvertUsing(Func<TSource, TDestination>)" and "IMappingExpression<TSource, TDestination>. ConvertUsing(Func<ResolutionContext, TDestination>)”



There are many such writing methods on the Internet, including official documentation, but I wrote a compilation error like this, which is probably the old version of writing, and now AutoMapper does not support it

The correct way to write it is as follows:







Previous:vs Develop copyright notes plugin [source code]
Next:AutoMapper Conversion Tutorial Between Objects [Source Code]
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com