From 939930acc2f1fbb31f44a726a7a04550483686bf Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 21 Feb 2023 20:39:54 +0800 Subject: [PATCH] Update data filter --- .../Abstract/DeleteProvider/DeleteableProvider.cs | 14 ++++++++++++++ Src/Asp.Net/SqlSugar/Enum/DataFilterType.cs | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs index d194fa178..67b95bf93 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs +++ b/Src/Asp.Net/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) + { + var model = new DataFilterModel() + { + OperationType = DataFilterType.DeleteByObject, + EntityValue = deleteObj, + }; + dataEvent(deleteObj,model); + } + } } } diff --git a/Src/Asp.Net/SqlSugar/Enum/DataFilterType.cs b/Src/Asp.Net/SqlSugar/Enum/DataFilterType.cs index 739edf121..e3bc424de 100644 --- a/Src/Asp.Net/SqlSugar/Enum/DataFilterType.cs +++ b/Src/Asp.Net/SqlSugar/Enum/DataFilterType.cs @@ -10,7 +10,8 @@ namespace SqlSugar public enum DataFilterType { UpdateByObject = 0, - InsertByObject = 1 + InsertByObject = 1, + DeleteByObject =2 } public class DataFilterModel {