I created a new Enum
class from db table Role
which has RoleId
and RoleType
.
public enum UserType
{
Student = 1,
Teacher = 4
Admin = 5
}
Here 1,4,5 are RoleId(Primary Key) from db. What i did is i looked manually for the db primary key value for each role and mapped that to enum
.
The demerit here is every time i need to update the enum
class when db RoleId
Changes.
Is there any other standard practice to map db values as enum
collections?
Any suggestions will help