Reputation:
I know how to use map without function. This is input:
Id: 1
Name: Something
Color: -9690922
And expected output:
Id: 1
Name: Something
Color: (29, 3, 201, 1)
I have a function that converts this color from number, but how to use it within the mapper?
Upvotes: 0
Views: 1185
Reputation: 550
You should use MapFrom option while creating map. So if your function to convert colour from number is CreateCol() use something like:
Mapper.CreateMap<EFAddress, Address>()
.ForMember(dest => dest.Color, opt => opt.MapFrom(src =>
CreateCol(src.Color)));
Upvotes: 2