From 91700aafb4e7fd2b9534d8d4b42d36d39d7248a0 Mon Sep 17 00:00:00 2001 From: sunkaixuna <610262374@qq.com> Date: Sat, 20 Nov 2021 23:53:56 +0800 Subject: [PATCH] Update aop --- .../Abstract/FastestProvider/FastestProvider.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/FastestProvider/FastestProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/FastestProvider/FastestProvider.cs index b380311b0..3d1f7edd3 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/FastestProvider/FastestProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/FastestProvider/FastestProvider.cs @@ -79,7 +79,7 @@ namespace SqlSugar #region Core private async Task _BulkUpdate(List datas, string[] whereColumns, string[] updateColumns) { - Begin(); + Begin(datas); var isAuto = this.context.CurrentConnectionConfig.IsAutoCloseConnection; this.context.CurrentConnectionConfig.IsAutoCloseConnection = false; DataTable dt = ToDdateTable(datas); @@ -91,38 +91,38 @@ namespace SqlSugar var result = await buider.UpdateByTempAsync(GetTableName(), dt.TableName, updateColumns, whereColumns); this.context.DbMaintenance.DropTable(dt.TableName); this.context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto; - End(); + End(datas); return result; } private async Task _BulkCopy(List datas) { - Begin(); + Begin(datas); DataTable dt = ToDdateTable(datas); IFastBuilder buider =GetBuider(); buider.Context = context; var result = await buider.ExecuteBulkCopyAsync(dt); - End(); + End(datas); return result; } #endregion #region AOP - private void End() + private void End(List datas) { this.context.Ado.IsEnableLogEvent = isLog; if (this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuted != null) { - this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuted("Begin bulkcopy "+ entityInfo.DbTableName, new SugarParameter[] { }); + this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuted($"End bulkcopy name:{entityInfo.DbTableName} ,count: {datas.Count},current time: {DateTime.Now}" , new SugarParameter[] { }); } } - private void Begin() + private void Begin(List datas) { isLog = this.context.Ado.IsEnableLogEvent; this.context.Ado.IsEnableLogEvent = false; if (this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuting != null) { - this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuting("End bulkcopy " + entityInfo.DbTableName, new SugarParameter[] { }); + this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuting($"Begin bulkcopy name:{entityInfo.DbTableName} ,count: {datas.Count},current time: {DateTime.Now} ", new SugarParameter[] { }); } } #endregion