From c7cf1a584536a530299b8519553606a81607eef1 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 29 Apr 2024 15:05:40 +0800 Subject: [PATCH] Synchronization code --- .../Abstract/FastestProvider/FastestProvider.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/FastestProvider/FastestProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/FastestProvider/FastestProvider.cs index 6091e7898..ecf3ee1f9 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/FastestProvider/FastestProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/FastestProvider/FastestProvider.cs @@ -307,6 +307,8 @@ namespace SqlSugar Check.Exception(updateColumns == null || updateColumns.Count() == 0, "set columns count=0"); var isAuto = this.context.CurrentConnectionConfig.IsAutoCloseConnection; this.context.CurrentConnectionConfig.IsAutoCloseConnection = false; + var old = this.context.Ado.IsDisableMasterSlaveSeparation; + this.context.Ado.IsDisableMasterSlaveSeparation = true; DataTable dt = ToDdateTable(datas); IFastBuilder buider = GetBuider(); ActionIgnoreColums(whereColumns, updateColumns, dt, buider.IsActionUpdateColumns); @@ -320,7 +322,8 @@ namespace SqlSugar this.context.DbMaintenance.DropTable(dt.TableName); } this.context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto; - buider.CloseDb(); + buider.CloseDb(); + this.context.Ado.IsDisableMasterSlaveSeparation = old; End(datas, false); return result; } @@ -374,6 +377,8 @@ namespace SqlSugar Check.Exception(updateColumns == null || updateColumns.Count() == 0, "set columns count=0"); var isAuto = this.context.CurrentConnectionConfig.IsAutoCloseConnection; this.context.CurrentConnectionConfig.IsAutoCloseConnection = false; + var old = this.context.Ado.IsDisableMasterSlaveSeparation; + this.context.Ado.IsDisableMasterSlaveSeparation = true; dataTable.TableName = this.queryable.SqlBuilder.GetTranslationTableName(tableName); DataTable dt = GetCopyWriteDataTableUpdate(dataTable); IFastBuilder buider = GetBuider(); @@ -397,7 +402,8 @@ namespace SqlSugar } this.context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto; buider.CloseDb(); - End(datas, false); + this.context.Ado.IsDisableMasterSlaveSeparation = old; + End(datas, false); return result; } private async Task _BulkCopy(List datas)