A couple of big features in this release include inline maps, where AutoMapper no longer requires you to call CreateMap for new maps.
To configure an inline map, use the mapping options 🤙🏻 :
var source = new Source();
var dest = Mapper.Map<Source, Dest>(source, opt => opt.ConfigureMap().ForMember(dest => dest.Value, m => m.MapFrom(src => src.Value + 10)));
You can use local functions to make the configuration a little easier to read 🤓 :
var source = new Source();
void ConfigureMap(IMappingOperationOptions<Source, Dest> opt) {
opt.ConfigureMap()
.ForMember(dest => dest.Value, m => m.MapFrom(src => src.Value + 10))
};
var dest = Mapper.Map<Source, Dest>(source, ConfigureMap);
https://t.me/pgimg/54
[ Release Notes ] : http://bit.do/atmp
〰〰〰〰〰〰
#AutoMapper #CSharp
@ProgrammingTip