I have settings defined using enum in C# backend each with unique number.
public enum Settings
{
Setting1 = 1,
Setting2 = 2,
//...
}
I send the settings to client using WebAPI in dictionary
public MyModel
{
public Dictionary<Settings, string> MySettings { get; set; }
//...other properties...
}
But the thing is I have this Enum defined in typescript as well and I want to refer to this using the enum.
The problem is WebAPI converts the enum to the string instead of a number. As the solution is quite large I don't want to remove the StringEnumConverter from configuration and just define the converter to number for this property only as well as preserve the type of the dictionary and not changing it to Dictionary<int, string>.
Is there a way, how to do this using attribute?