Update core

This commit is contained in:
sunkaixuna 2021-11-22 11:50:53 +08:00
parent dec730190a
commit b9234bf5ed
4 changed files with 8 additions and 3 deletions

View File

@ -93,6 +93,7 @@ namespace SqlSugar
var result = await buider.UpdateByTempAsync(GetTableName(), dt.TableName, updateColumns, whereColumns);
this.context.DbMaintenance.DropTable(dt.TableName);
this.context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto;
buider.CloseDb();
End(datas);
return result;
}

View File

@ -13,5 +13,6 @@ namespace SqlSugar
Task<int> UpdateByTempAsync(string tableName,string tempName,string [] updateColumns,string[] whereColumns);
Task<int> ExecuteBulkCopyAsync(DataTable dt);
Task CreateTempAsync<T>(DataTable dt) where T : class, new();
void CloseDb();
}
}

View File

@ -8,7 +8,7 @@ namespace SqlSugar
public interface IFastest<T>
{
IFastest<T> AS(string tableName);
IFastest<T> PageSize(int Size);
int BulkCopy(List<T> datas);
Task<int> BulkCopyAsync(List<T> datas);

View File

@ -44,7 +44,7 @@ namespace SqlSugar
try
{
var identityColumnInfo = this.entityInfo.Columns.FirstOrDefault(it => it.IsIdentity);
if (identityColumnInfo!=null)
if (identityColumnInfo != null)
{
throw new Exception("PgSql bulkcopy no support identity");
}
@ -52,9 +52,12 @@ namespace SqlSugar
}
catch (Exception ex)
{
base.CloseDb();
throw ex;
}
finally
{
base.CloseDb();
}
return await Task.FromResult(dt.Rows.Count);
}