I’m a complete noob to Automapper and I’m wondering if its possible to map 2 enum values in the source to 1 in the destination.
In the example below I want to map both VisaCredit and VisaDebit to Visa.
Source:
public enum CardType { VisaCredit, VisaDebit, MasterCard, AmericanExpress, SwitchMaestro }
Destination:
public enum CardType { Visa, MasterCard, AmericanExpress, SwitchMaestro }
You could create a mapping for those types, then define a custom converter:
Your card type mapping function would look something similar to this (other mappings omitted for brevity):
This might not be the most succinct method available for mapping two enum values to one, but it should work.