mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Synchronization code
This commit is contained in:
@@ -299,6 +299,30 @@ namespace SqlSugar
|
||||
{
|
||||
this.context.CurrentConnectionConfig?.AopEvents?.OnLogExecuting($"Begin {title} name:{GetTableName()} ,count: {datas.Count},current time: {DateTime.Now} ", new SugarParameter[] { });
|
||||
}
|
||||
var dataEvent = this.context.CurrentConnectionConfig.AopEvents?.DataExecuting;
|
||||
if (IsDataAop&&dataEvent!=null)
|
||||
{
|
||||
var entity = this.context.EntityMaintenance.GetEntityInfo(typeof(Type));
|
||||
foreach (var item in datas)
|
||||
{
|
||||
DataAop(item, isAdd
|
||||
?
|
||||
DataFilterType.InsertByObject:
|
||||
DataFilterType.UpdateByObject
|
||||
, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void DataAop<Type>(Type item, DataFilterType type,EntityInfo entity)
|
||||
{
|
||||
var dataEvent = this.context.CurrentConnectionConfig.AopEvents?.DataExecuting;
|
||||
if (dataEvent != null && item != null)
|
||||
{
|
||||
foreach (var columnInfo in entity.Columns)
|
||||
{
|
||||
dataEvent(columnInfo.PropertyInfo.GetValue(item, null), new DataFilterModel() { OperationType = type, EntityValue = item, EntityColumnInfo = columnInfo });
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@@ -13,11 +13,17 @@ namespace SqlSugar
|
||||
private string CacheKey { get; set; }
|
||||
private string CacheKeyLike { get; set; }
|
||||
private string CharacterSet { get; set; }
|
||||
private bool IsDataAop { get; set; }
|
||||
public IFastest<T> SetCharacterSet(string CharacterSet)
|
||||
{
|
||||
this.CharacterSet = CharacterSet;
|
||||
return this;
|
||||
}
|
||||
public IFastest<T> EnableDataAop()
|
||||
{
|
||||
this.IsDataAop = true;
|
||||
return this;
|
||||
}
|
||||
public IFastest<T> RemoveDataCache()
|
||||
{
|
||||
CacheKey = typeof(T).FullName;
|
||||
|
@@ -13,6 +13,7 @@ namespace SqlSugar
|
||||
IFastest<T> AS(string tableName);
|
||||
IFastest<T> PageSize(int Size);
|
||||
IFastest<T> SetCharacterSet(string CharacterSet);
|
||||
IFastest<T> EnableDataAop();
|
||||
int BulkCopy(List<T> datas);
|
||||
Task<int> BulkCopyAsync(List<T> datas);
|
||||
int BulkCopy(string tableName,DataTable dataTable);
|
||||
|
Reference in New Issue
Block a user