Browse Source

Synchronization code

pull/31/head
sunkaixuan 2 years ago
parent
commit
33b906a721
  1. 14
      Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs
  2. 3
      Src/Asp.NetCore2/SqlSugar/Enum/DataFilterType.cs

14
Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs

@ -108,6 +108,7 @@ namespace SqlSugar
Where(SqlBuilder.SqlFalse); Where(SqlBuilder.SqlFalse);
return this; return this;
} }
DataAop(deleteObjs);
string tableName = this.Context.EntityMaintenance.GetTableName<T>(); string tableName = this.Context.EntityMaintenance.GetTableName<T>();
var primaryFields = this.GetPrimaryKeys(); var primaryFields = this.GetPrimaryKeys();
var isSinglePrimaryKey = primaryFields.Count == 1; var isSinglePrimaryKey = primaryFields.Count == 1;
@ -620,5 +621,18 @@ namespace SqlSugar
} }
return result; 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);
}
}
} }
} }

3
Src/Asp.NetCore2/SqlSugar/Enum/DataFilterType.cs

@ -10,7 +10,8 @@ namespace SqlSugar
public enum DataFilterType public enum DataFilterType
{ {
UpdateByObject = 0, UpdateByObject = 0,
InsertByObject = 1 InsertByObject = 1,
DeleteByObject =2
} }
public class DataFilterModel public class DataFilterModel
{ {

Loading…
Cancel
Save