Synchronization code

This commit is contained in:
sunkaixuan 2023-02-21 20:47:56 +08:00
parent 44f24c41d6
commit 33b906a721
2 changed files with 16 additions and 1 deletions

View File

@ -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&& dataEvent!=null)
{
var model = new DataFilterModel()
{
OperationType = DataFilterType.DeleteByObject,
EntityValue = deleteObj,
};
dataEvent(deleteObj,model);
}
}
}
}

View File

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