'AutoMapper .AfterMap() vs .ForMember()
I was facing an issue where I could use the .AfterMap() method or the .ForMember() method from AutoMapper. I was researching a little bit but did not find any information about it. What is the difference between them or when would you use one over the other?
AfterMap:
.AfterMap((src, dest) => dest.SomeDestinationProperty = src.SomeSourceProperty);
ForMember:
.ForMember(
dest => dest.SomeDestinationProperty,
opt => opt.MapFrom(src => src.SomeSourceProperty)
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
