我想更新数据库中的模型更改。其实在我通过迁移通过以下代码更新数据库之前
public int id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public string Icon { get; set; }
[Required]
[StringLength(maximumLength: 150, MinimumLength = 50)]
public string Description { get; set; }
public string Date { get; set; }
但是现在我想更新以下代码
public int id { get; set; }
[Required]
[StringLength(maximumLength: 50)]
public string Name { get; set; }
[Required]
[StringLength(maximumLength:50)]
public string Icon { get; set; }
[Required]
[StringLength(maximumLength: 150, MinimumLength = 50)]
public string Description { get; set; }
//[Column(TypeName = "Date")]
public DateTime? Date { get; set; }
但收到此错误
Cannot insert the value NULL into column 'Date', table 'ConstructionDb.dbo.Services'; column does not allow nulls. UPDATE fails.
The statement has been terminated.