AutoMapper Field Mapping not working as expected to previous version

Viewed 33

I am facing some challenges after I upgrade AutoMapper from 6.1.1 to 11.0.0.

Earlier I had my source model with Field name CountyName which was getting mapped to County and CountryCode3 to CountryCode3Char repectively

Only change made as static members no more available.

AutoMapper 6.1.1:

var mappedAddress = Mapper.Map<SourceAddress, DestinationAddress>(sourceModel);

AutoMapper 11.0.0:

var config = new MapperConfiguration(cfg => cfg.CreateMap<SourceAddress, DestinationAddress>());
var mapper = new Mapper(config);
var mappedAddress = mapper.Map<DestinationAddress>(sourceModel);

What would be needed more to make this working? Do not want to update fields due to large number of consumers of this service.

0 Answers
Related