In Part 5, we will use a powerful feature that automapper allows us, which is CustomResolver.

Lets look at our Domain Object which contains a boolean field called ShipToHomeAddress, what we will do is map those boolean to a string value with “Yes” or “No”.

For our mapping code we will introduce CustomResolver class which inherits from ValueResolver and would map the boolean field to string

Now our mapping code would look like

The end result of the view looks like

In Part6, I will show how to use a CustomerFormatter with a Resolver to format the data in a certain way.

Previous Post:
Part 1 (NullSubsitution)
Part 2 (Flattening by Convention)
Part 3 (Nested Mapping)
Part 4 (Projection)