您是否有更简洁的方法在数据库中设置默认值,而不是像下面的部分类中初始化那样?
[MetadataType(typeof(PersonAttribute))]
public partial class person {
public person() {
isMale = true;
}
}
public class PersonAttribute
{
[Display(Name = "Title")]
[Required(ErrorMessage = "Please enter the news title.")]
public string UserTitle { get; set; }
public bool isMale { get; set; }
}