I have a public facing interface that I’m trying to map two different enumerations to each other. I tried to use the following code:
Mapper.CreateMap<Contract_1_1_0.ValidationResultType, Common.ValidationResultType>();
When that didn’t work, I tried:
Mapper.CreateMap<Contract_1_1_0.ValidationResultType, Common.ValidationResultType>().ConvertUsing(x => (Common.ValidationResultType)((int)x));
But that doesn’t seem to work either. Is there anyway to get automapper to handle this scenario?
You don’t need to do CreateMap for enum types. Just get rid of the CreateMap call and it should work, as long as the names and/or values match up between enum types.