I am using Entity Framework Code First to build my database. I have categories which do not change often, but could potentially change in the future. Would it be better practice to store the category data in enums or in an actual table? Below is an example of the ways I would implement the two approaches:
With an enum:
public enum Role
{
Administrator, Employee, Developer
}
public class User
{
public int ID {get;set;}
public string Name { get; set; }
public Role Role { get; set; }
}
With a separate table:
public class User
{
public int ID { get; set; }
public string Name { get; set; }
public int RoleID { get; set; } // Foreign key to Role table
public virtual Role Role { get; set; } // Navigation property for Role
}
public class Role
{
public int ID { get; set; }
public string RoleName { get; set; }
}