Automapper version 8.0.0 removed ResolveUsing extension method from IMappingExpression and consolidated it with MapFrom extension method. However, after replacing ResolveUsing with MapFrom method, certain configurations throw exception.
Original ResolveUsing:
CreateMap<SourceType, DestinationType>()
.ForMember(dest => dest.Customer,
opt => opt.ResolveUsing(src => src?.Customer ?? new Customer())
);
Replaced with MapFrom:
CreateMap<SourceType, DestinationType>()
.ForMember(dest => dest.Customer,
opt => opt.MapFrom(src => src?.Customer ?? new Customer())
);
This produces compilation error:
Error CS8072
Automapper
An expression tree lambda may not contain a null propagating operator.