如何修复Auto-mapper空异常错误

时间:2019-06-14 14:49:21

标签: c# asp.net-web-api automapper

我正在使用自动映射器,并且出现

之类的错误

System.NullReferenceException at lambda_method(Closure,Employee)在

.lambda_method(System.Runtime.CompilerServices.Closure,Employee)

我的代码是

      .ForMember(d => d.Name, opt => opt.MapFrom(o => o.Name)) 
      .ForMember(d => d.City, opt => opt.MapFrom(o => o.City)) 
      .ForMember(d => d.Phone, opt => opt.MapFrom(o => o.PhoneNo))```

0 个答案:

没有答案