Rit*_*jak 7 profile automapper
public class AutoMapperBootstrap : AutoMapper.Profile
{
protected override void Configure()
{
//ReplaceMemberName("Z", "A");
//CreateMap<Source, Destination>();
}
public override string ProfileName
{
get { return this.GetType().Name; }
}
}
Run Code Online (Sandbox Code Playgroud)
我在我的MVC应用程序的App_Start文件夹中有这个AutoMapperBootstrap类.
在"configure"方法中,它给出了编译器错误 - "No Suitable method to override",我得到的是configure方法的错误而不是ProfileName的错误
我在自定义Automapper配置文件中的StackOverflow覆盖配置文件的配置方法中看到了很多示例.
但是为什么我得到这个编译错误.
请让我知道我犯的错误是什么?
或者是最新版本的Automapper没有覆盖此Configure方法.
注意:我已将Nuget的最新Automapper版本6.1.1.0下载到我的应用程序中.
Mat*_*per 14
较新版本的AutoMapper 具有不同的设置配置文件的方法.我正在使用此处描述的方法在.net项目中的类库中设置自动化.
namespace Project.Helpers
{
public class NewMapperProfile : Profile
{
public NewMapperProfile()
{
CreateMap<ClassA, ClassB>();
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2746 次 |
最近记录: |