Automapper 5.0抛出异常

时间:2016-08-10 15:21:07

标签: c# automapper

例外:

  

Configuration ='AutoMapper.Mapper.Configuration'引发了'System.InvalidOperationException'类型的异常

代码:

var config = new MapperConfiguration(cfg => {
            cfg.CreateMap<CrmMapper.ExamModel, CrmMapper.ExamInventoryModel>()
           .ForMember(v => v.ExamId, opts => opts.MapFrom(src => src.ExamId));              
        });

IMapper mapper = config.CreateMapper();

var source = new ExamModel();            
var dest = mapper.Map<ExamModel, ExamInventoryModel> (source);

0 个答案:

没有答案