AutoMapper Map If Not Null, Otherwise Custom Convert

前端 未结 4 1148
伪装坚强ぢ
伪装坚强ぢ 2021-02-02 08:29

Here\'s my code:

Mapper.CreateMap()
   .ForMember(dest => dest.Bar, opt => opt.MapFrom(src => src.Bar == null ? new BarViewModel() : sr         


        
4条回答
  •  执笔经年
    2021-02-02 09:04

    As of Automapper 8, ResolveUsing is no longer an option but inline Func's, IValueResolver and IMemberValueResolver are

提交回复
热议问题