I have a simple class, of which one of the properties is an enum. For example:
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
public Gender Gender { get; set; }
}
public enum Gender
{
[EnumMember(Value = "M")]
Male, // database uses 'M' instead of 'Male'
[EnumMember(Value = "F")]
Female // database uses 'F' instead of 'Female'
}
My data is stored with slightly different values for Gender - M instead of Male, and F instead of Female. For example:
How can I map the DB value of M to the enum value of Gender.Male, and likewise, F to Gender.Female?
