mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
Synchronous code
This commit is contained in:
@@ -368,7 +368,7 @@ namespace SqlSugar
|
||||
var dbColumn = entityInfo.Columns.FirstOrDefault(z => z.PropertyName == it.Key);
|
||||
if (dbColumn == null&&entityInfo.Discrimator==null)
|
||||
{
|
||||
Check.ExceptionEasy($"{entityInfo.EntityName} no SugarIndex[ {it.Key} ] found", $"类{entityInfo.EntityName} 索引特性没找到属性名 :{it.Key}");
|
||||
Check.ExceptionEasy($"{entityInfo.EntityName} no SugarIndex[ {it.Key} ] found", $"类{entityInfo.EntityName} 索引特性没找到列 :{it.Key}");
|
||||
}
|
||||
return new KeyValuePair<string, OrderByType>(dbColumn.DbColumnName, it.Value);
|
||||
})
|
||||
|
@@ -119,6 +119,7 @@ namespace SqlSugar
|
||||
string tableName = this.Context.EntityMaintenance.GetTableName<T>();
|
||||
var primaryFields = this.GetPrimaryKeys();
|
||||
var isSinglePrimaryKey = primaryFields.Count == 1;
|
||||
var isNvarchar = false;
|
||||
Check.Exception(primaryFields.IsNullOrEmpty(), string.Format("Table {0} with no primarykey", tableName));
|
||||
if (isSinglePrimaryKey)
|
||||
{
|
||||
@@ -128,6 +129,7 @@ namespace SqlSugar
|
||||
{
|
||||
var entityPropertyName = this.Context.EntityMaintenance.GetPropertyName<T>(primaryField);
|
||||
var columnInfo = EntityInfo.Columns.Single(it => it.PropertyName.Equals(entityPropertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||
isNvarchar = columnInfo.SqlParameterDbType is System.Data.DbType dbtype && dbtype == System.Data.DbType.String;
|
||||
var value = columnInfo.PropertyInfo.GetValue(deleteObj, null);
|
||||
value = UtilMethods.GetConvertValue(value);
|
||||
if (this.Context.CurrentConnectionConfig?.MoreSettings?.TableEnumIsString!=true&&
|
||||
@@ -151,7 +153,15 @@ namespace SqlSugar
|
||||
}
|
||||
else if (primaryKeyValues.Count < 10000)
|
||||
{
|
||||
var inValueString = primaryKeyValues.ToArray().ToJoinSqlInVals();
|
||||
var inValueString = string.Empty;
|
||||
if (isNvarchar)
|
||||
{
|
||||
inValueString = primaryKeyValues.ToArray().ToJoinSqlInValsByVarchar();
|
||||
}
|
||||
else
|
||||
{
|
||||
inValueString = primaryKeyValues.ToArray().ToJoinSqlInVals();
|
||||
}
|
||||
Where(string.Format(DeleteBuilder.WhereInTemplate, SqlBuilder.GetTranslationColumnName(primaryFields.Single()), inValueString));
|
||||
}
|
||||
else
|
||||
|
@@ -128,6 +128,10 @@ namespace SqlSugar
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.SqlParameterDbType is System.Data.DbType dbtype)
|
||||
{
|
||||
paramters.DbType = dbtype;
|
||||
}
|
||||
if (item.IsJson)
|
||||
{
|
||||
paramters.IsJson = true;
|
||||
|
@@ -521,6 +521,10 @@ namespace SqlSugar
|
||||
parameter.IsJson = true;
|
||||
SqlBuilder.ChangeJsonType(parameter);
|
||||
}
|
||||
if (item.SqlParameterDbType is System.Data.DbType dbtype)
|
||||
{
|
||||
parameter.DbType = dbtype;
|
||||
}
|
||||
if (item.IsArray)
|
||||
{
|
||||
parameter.IsArray = true;
|
||||
|
Reference in New Issue
Block a user