Update bulkCopy

This commit is contained in:
sunkaixuan
2024-04-29 15:04:22 +08:00
parent b9b6fb7f8e
commit 0f04e00ba1
2 changed files with 6 additions and 3 deletions

View File

@@ -322,8 +322,8 @@ namespace SqlSugar
this.context.DbMaintenance.DropTable(dt.TableName); this.context.DbMaintenance.DropTable(dt.TableName);
} }
this.context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto; this.context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto;
buider.CloseDb();
this.context.Ado.IsDisableMasterSlaveSeparation = old; this.context.Ado.IsDisableMasterSlaveSeparation = old;
buider.CloseDb();
End(datas, false); End(datas, false);
return result; return result;
} }
@@ -377,6 +377,8 @@ namespace SqlSugar
Check.Exception(updateColumns == null || updateColumns.Count() == 0, "set columns count=0"); Check.Exception(updateColumns == null || updateColumns.Count() == 0, "set columns count=0");
var isAuto = this.context.CurrentConnectionConfig.IsAutoCloseConnection; var isAuto = this.context.CurrentConnectionConfig.IsAutoCloseConnection;
this.context.CurrentConnectionConfig.IsAutoCloseConnection = false; this.context.CurrentConnectionConfig.IsAutoCloseConnection = false;
var old = this.context.Ado.IsDisableMasterSlaveSeparation;
this.context.Ado.IsDisableMasterSlaveSeparation = true;
dataTable.TableName = this.queryable.SqlBuilder.GetTranslationTableName(tableName); dataTable.TableName = this.queryable.SqlBuilder.GetTranslationTableName(tableName);
DataTable dt = GetCopyWriteDataTableUpdate(dataTable); DataTable dt = GetCopyWriteDataTableUpdate(dataTable);
IFastBuilder buider = GetBuider(); IFastBuilder buider = GetBuider();
@@ -400,7 +402,8 @@ namespace SqlSugar
} }
this.context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto; this.context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto;
buider.CloseDb(); buider.CloseDb();
End(datas, false); this.context.Ado.IsDisableMasterSlaveSeparation = old;
End(datas, false);
return result; return result;
} }
private async Task<int> _BulkCopy(List<T> datas) private async Task<int> _BulkCopy(List<T> datas)

View File

@@ -2,7 +2,7 @@
<package > <package >
<metadata> <metadata>
<id>SqlSugarCore</id> <id>SqlSugarCore</id>
<version>5.1.4.154-preview09</version> <version>5.1.4.154-preview11</version>
<authors>sunkaixuan</authors> <authors>sunkaixuan</authors>
<owners>果糖大数据科技</owners> <owners>果糖大数据科技</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl> <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>