GET: /API/Enums/GetAll Returns enums that have EnumAttribute or exists in EnumConfiguration.AllowedToExpose. π
Also, enums exists in EnumConfiguration.NotAllowedToExpose will not be returned!
Scenario 1 - I want expose test enum with EnumAttrbute:
β Due to the existence of enum attribute, this enum is exposed
[Enum(DisplayName = "This is enum name", Description = "This is enum description")]
public enum TestEnum
{
[EnumValue(DisplayName = "This is A name", Description = "This is A description")] A,
[EnumValue(DisplayName = "This is B name", Description = "This is B description")] B,
[EnumValue(DisplayName = "This is C name", Description = "This is C description")] C
}
Scenario 2 - I want expose test enum with adding to EnumConfiguration.AllowedToExpose:
β This code can located inside Startup.csβ This method can be used when we want to expose the enum outside the assembly or project
Scenario 3 - I do not want expose test enum:
β This code can located inside Startup.csβ This method can be used when we do not want an enum to be exposed
GET: /API/Enums/GetAll Returns enums that have EnumAttribute or exists in EnumConfiguration.AllowedToExpose. π Also, enums exists in EnumConfiguration.NotAllowedToExpose will not be returned!
Scenario 1 - I want expose test enum with EnumAttrbute: β Due to the existence of enum attribute, this enum is exposed
Scenario 2 - I want expose test enum with adding to EnumConfiguration.AllowedToExpose: β This code can located inside Startup.cs β This method can be used when we want to expose the enum outside the assembly or project
Scenario 3 - I do not want expose test enum: β This code can located inside Startup.cs β This method can be used when we do not want an enum to be exposed
Sample Output: