From 83779a671a206326a66e9b2b90d4a9d44df28a19 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 14 Dec 2022 19:48:56 +0800 Subject: [PATCH] Add EnableDiffLogEventIF --- .../DeleteProvider/DeleteableProvider.cs | 16 +++++++++++++--- .../SqlSugar/Interface/IDeleteable.cs | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs index 2f0c50a20..c0d130f73 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs @@ -53,7 +53,7 @@ namespace SqlSugar string sql; SugarParameter[] paramters; _ExecuteCommand(out sql, out paramters); - var result =await Db.ExecuteCommandAsync(sql, paramters); + var result = await Db.ExecuteCommandAsync(sql, paramters); After(sql); return result; } @@ -61,7 +61,7 @@ namespace SqlSugar { return await ExecuteCommandAsync() > 0; } - public IDeleteable AsType(Type tableNameType) + public IDeleteable AsType(Type tableNameType) { return AS(this.Context.EntityMaintenance.GetEntityInfo(tableNameType).DbTableName); } @@ -79,7 +79,17 @@ namespace SqlSugar this.Context.MappingTables.Add(entityName, tableName); return this; ; } - + public IDeleteable EnableDiffLogEventIF(bool isEnableDiffLogEvent, object businessData = null) + { + if (isEnableDiffLogEvent) + { + return EnableDiffLogEvent(businessData); + } + else + { + return this; + } + } public IDeleteable EnableDiffLogEvent(object businessData = null) { diff --git a/Src/Asp.NetCore2/SqlSugar/Interface/IDeleteable.cs b/Src/Asp.NetCore2/SqlSugar/Interface/IDeleteable.cs index 249418b4c..54470a02a 100644 --- a/Src/Asp.NetCore2/SqlSugar/Interface/IDeleteable.cs +++ b/Src/Asp.NetCore2/SqlSugar/Interface/IDeleteable.cs @@ -34,6 +34,7 @@ namespace SqlSugar IDeleteable WhereColumns(List list,Expression> columns); IDeleteable WhereColumns(List> columns); IDeleteable Where(List conditionalModels); + IDeleteable EnableDiffLogEventIF(bool isEnableDiffLogEvent, object businessData = null); IDeleteable EnableDiffLogEvent(object businessData = null); IDeleteable RemoveDataCache(); IDeleteable RemoveDataCache(string likeString);