1
如何在codefirst映射中映射枚舉屬性?如何在codefirst結構上映射枚舉屬性?
我的枚舉:
public enum GenderType : int
{
Male = 0,
Female = 1
}
我的模型
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
{
//不工作:不能含蓄轉換int類型.... {返回性別; } set {gender =(int)value; } }
我的配置
Property(model => model.Comment)
.HasMaxLength(4000)
.IsUnicode();
Property(model => model.Culture)
.IsOptional()
.HasMaxLength(10);
----- HOW TO WRITE GENDER?