Browse Source

Update data filter

pull/31/head
sunkaixuan 2 years ago
parent
commit
939930acc2
  1. 14
      Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs
  2. 3
      Src/Asp.Net/SqlSugar/Enum/DataFilterType.cs

14
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<T>();
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);
}
}
}
}

3
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
{

Loading…
Cancel
Save