为什么示例中的此映射未正确映射。当我将后缀CAST更改为其他内容(CAST1)时,它会正确映射。如何设置映射器以使用后缀CAST正确映射?
public class Class1
{
public string OBEC { get; set; }
public string OBEC_CAST { get; set; }
}
public class Class2
{
public string Obec { get; set; }
public string ObecCast { get; set; }
}
public void Map()
{
Class1 c1 = new Class1() { OBEC = "obec", OBEC_CAST = "cast obce" };
Class2 c2 = Mapper.Map<Class2>(c1);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
Mapper.Initialize(cfg =>
{
cfg.RecognizePrefixes(new string [0]);
cfg.RecognizePostfixes(new string[0]);
cfg.ClearPrefixes();
cfg.SourceMemberNamingConvention = new LowerUnderscoreNamingConvention();
cfg.DestinationMemberNamingConvention = new PascalCaseNamingConvention();
cfg.CreateMap<Class1, Class2>();
});
}