报错:Missing type map configuration or unsupported mapping
□ 背景
当把View Model转换成Domain Model保存的时候,发生在AutoMapper的错误。
□ 分析
1、在派生于AutoMapper的Profile的类中已经建立映射:
Mapper.CreateMap<SomeDomainModel, SomeViewModel>();
2、也已经初始化派生于Profile的类:
public static class AutoMapperConfiguration
{
public static void Configure()
{
Mapper.Initialize(x => x.AddProfile<SomeProfile>());