mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 04:23:47 +08:00
Update Aop.DataChanges
This commit is contained in:
@@ -292,6 +292,39 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DataChangesAop(T [] items)
|
||||||
|
{
|
||||||
|
var dataEvent = this.Context.CurrentConnectionConfig.AopEvents?.DataChangesExecuted;
|
||||||
|
if (dataEvent != null)
|
||||||
|
{
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
foreach (var columnInfo in this.EntityInfo.Columns)
|
||||||
|
{
|
||||||
|
if (columnInfo.ForOwnsOnePropertyInfo != null)
|
||||||
|
{
|
||||||
|
var data = columnInfo.ForOwnsOnePropertyInfo.GetValue(item, null);
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
dataEvent(columnInfo.PropertyInfo.GetValue(data, null), new DataFilterModel() { OperationType = DataFilterType.UpdateByObject, EntityValue = item, EntityColumnInfo = columnInfo });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (columnInfo.PropertyInfo.Name == "Item" && columnInfo.IsIgnore)
|
||||||
|
{
|
||||||
|
//class index
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dataEvent(columnInfo.PropertyInfo.GetValue(item, null), new DataFilterModel() { OperationType = DataFilterType.UpdateByObject, EntityValue = item, EntityColumnInfo = columnInfo });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckTranscodeing(bool checkIsJson = true)
|
private void CheckTranscodeing(bool checkIsJson = true)
|
||||||
{
|
{
|
||||||
if (this.EntityInfo.Columns.Any(it => it.IsTranscoding))
|
if (this.EntityInfo.Columns.Any(it => it.IsTranscoding))
|
||||||
|
@@ -134,6 +134,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
After(sql);
|
After(sql);
|
||||||
|
DataChangesAop(this.UpdateObjs);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public bool ExecuteCommandHasChange()
|
public bool ExecuteCommandHasChange()
|
||||||
@@ -184,6 +185,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
var result = await this.Ado.ExecuteCommandAsync(sql, UpdateBuilder.Parameters == null ? null : UpdateBuilder.Parameters.ToArray());
|
var result = await this.Ado.ExecuteCommandAsync(sql, UpdateBuilder.Parameters == null ? null : UpdateBuilder.Parameters.ToArray());
|
||||||
After(sql);
|
After(sql);
|
||||||
|
DataChangesAop(this.UpdateObjs);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public Task<bool> ExecuteCommandHasChangeAsync(CancellationToken token)
|
public Task<bool> ExecuteCommandHasChangeAsync(CancellationToken token)
|
||||||
|
Reference in New Issue
Block a user