From 33b906a7217160c304587122cbcfefbdd613423f Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 21 Feb 2023 20:47:56 +0800 Subject: [PATCH] Synchronization code --- .../Abstract/DeleteProvider/DeleteableProvider.cs | 14 ++++++++++++++ Src/Asp.NetCore2/SqlSugar/Enum/DataFilterType.cs | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs index d194fa178..2c021bafb 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs @@ -108,6 +108,7 @@ namespace SqlSugar Where(SqlBuilder.SqlFalse); return this; } + DataAop(deleteObjs); string tableName = this.Context.EntityMaintenance.GetTableName(); var primaryFields = this.GetPrimaryKeys(); var isSinglePrimaryKey = primaryFields.Count == 1; @@ -620,5 +621,18 @@ namespace SqlSugar } return result; } + private void DataAop(object deleteObj) + { + var dataEvent = this.Context.CurrentConnectionConfig.AopEvents?.DataExecuting; + if (deleteObj != null&& dataEvent!=null) + { + var model = new DataFilterModel() + { + OperationType = DataFilterType.DeleteByObject, + EntityValue = deleteObj, + }; + dataEvent(deleteObj,model); + } + } } } diff --git a/Src/Asp.NetCore2/SqlSugar/Enum/DataFilterType.cs b/Src/Asp.NetCore2/SqlSugar/Enum/DataFilterType.cs index 739edf121..e3bc424de 100644 --- a/Src/Asp.NetCore2/SqlSugar/Enum/DataFilterType.cs +++ b/Src/Asp.NetCore2/SqlSugar/Enum/DataFilterType.cs @@ -10,7 +10,8 @@ namespace SqlSugar public enum DataFilterType { UpdateByObject = 0, - InsertByObject = 1 + InsertByObject = 1, + DeleteByObject =2 } public class DataFilterModel {