Add Check

This commit is contained in:
sunkaixuan
2017-08-30 13:28:27 +08:00
parent 7d49560e66
commit 560983a34a

View File

@@ -30,6 +30,7 @@ namespace SqlSugar
PreToSql(); PreToSql();
string sql = UpdateBuilder.ToSqlString(); string sql = UpdateBuilder.ToSqlString();
RestoreMapping(); RestoreMapping();
Check.Exception(UpdateBuilder.WhereValues.IsNullOrEmpty() && GetPrimaryKeys().IsNullOrEmpty(), "You cannot have no primary key and no conditions");
return this.Ado.ExecuteCommand(sql, UpdateBuilder.Parameters == null ? null : UpdateBuilder.Parameters.ToArray()); return this.Ado.ExecuteCommand(sql, UpdateBuilder.Parameters == null ? null : UpdateBuilder.Parameters.ToArray());
} }
public IUpdateable<T> AS(string tableName) public IUpdateable<T> AS(string tableName)