I am currently testing with AutoMapper, but i currently have a case where the property names do not match each other, so a custom type convert was needed. But when i use the custom type converter, i have to map all other properties manually? i can't call another Map inside the type converter ofcourse as this will cause a overflow.
This is unwanted as there are at most 3 model specific properties that do not match per model so i DO want the other properties to be automaticaly mapped.
Could anyone point me in the right direction for this one?
You don't need to use a custom type converter to map classes where there a few properties that simply have names that don't match. Custom type converters are for when you need to, as they say, "take complete control over the conversion of one type to another".
Set up the map with
CreateMap()
and then set some extra rules usingForMember()
, like this:This maps
LastName
andDOB
from the sourcePerson
class to theSurname
andDateOfBirth
properties of the destinationCustomer
class.