文章内容
2017/7/15 11:26:07,作 者: 黄兵
entity framework not null
public int Id { get; set; } [DisplayName("主题名称")] [MaxLength(250)] public string TopicName { get; set; } public ICollection<TopicList> TopicList { get; set; }
如何设置TopicName不为空(not null)
解决方法如下:
public int Id { get; set; }
[DisplayName("主题名称")]
[MaxLength(250)]
[Required]
public string TopicName { get; set; }
public ICollection<TopicList> TopicList { get; set; }
黄兵的个人博客原创。
评论列表