答案 0 :(得分:1)
默认情况下,EF仅验证添加和修改的实体。那么,也许您覆盖方法ShouldValidateEntity
并始终返回true
?
你可以这样改变它:
protected override bool ShouldValidateEntity(DbEntityEntry entityEntry)
{
if (entityEntry.State == EntityState.Deleted)
return false;
return true;
}