I am trying to map an enum value to another using
CreateMap<Enum1, Enum2>()
.ConvertUsingEnumMapping(m => m.MapByName())
.ReverseMap();
The enums are like this
public enum Enum1
{
action1 = 1,
action2 = 2
aliasAction1 = 1
}
public enum Enum2
{
action1 = 1,
action2 = 2
aliasAction1 = 1
}
When running the mapping validation test using
configuration.AssertConfigurationIsValid();
I get an error regarding the enum value key already exists. Even though I am doing mapping by name instead of by value. Specifically
System.ArgumentException : An item with the same key has already been added.
Is there any way to perform this mapping without doing it manually myself?
EDIT Extra info to avoid a possible hail-storm
I understand that non-unique enum values are to be frowned upon and avoided at all costs, but, the enum is provided from a third party that I need to convert to proto for internal use, thus the need for mapping using Automapper.