I am trying to make something very simple. I want to use the Enum column type in my Code First solution. I am using the stable version of Entity Framework 5.0.
Consider my Enum and Model wrapper class:
public class Enums { public enum UserType { Bronze = 0, Silver = 1, Gold = 2, Admin = 4 } } public class User { public int UserId { get; set; } public string UserName { get; set; } public Enums.UserType UserType { get; set; } }
If I generate a database, the UserType column UserType not be generated. When I remove the wrapper ' class around my Enum as follows:
public enum UserType { Bronze = 0, Silver = 1, Gold = 2, Admin = 4 } public class User { public int UserId { get; set; } public string UserName { get; set; } public UserType UserType { get; set; } }
Created by DOES ! Is my first setup so unusual or “please stay away”?
I would like to hear some suggestions that are standardized or best practices and / or explanations of why my first setup does not work.
source share