How to map enums property in codefirst mapping?
My enum:
public enum GenderType : int { Male = 0, Female = 1 } My Model
public string City { get; set; } public string Country { get; set; } public string Occupation { get; set; } public string WebsiteURL { get; set; } public GenderType Gender { get; set; } public int gender { get; set; } public GenderType Gender { // NOT WORKING : Can not implicity convert type int .... get { return gender; } set { gender = (int)value; } }
My Configuration
Property(model => model.Comment) .HasMaxLength(4000) .IsUnicode(); Property(model => model.Culture) .IsOptional() .HasMaxLength(10); ----- HOW TO WRITE GENDER?