Skip to content

Commit 33612bd

Browse files
2881028810
authored andcommitted
- 增加 Aop.AuditValue 事件,在插入/更新数据时审计属性值;
1 parent b57d35a commit 33612bd

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

FreeSql/Interface/IAop.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public object Value
306306
}
307307
}
308308
private object _value;
309-
internal bool IsChanged { get; private set; }
309+
public bool IsChanged { get; private set; }
310310
}
311311
public enum AutoValueType { Update, Insert }
312312
}

FreeSql/Internal/CommonProvider/InsertProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ public virtual string ToSql()
563563
{
564564
var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Insert, col, _table.Properties[col.CsName], val);
565565
_orm.Aop.AuditValue(this, auditArgs);
566-
if (auditArgs.Value != null)
566+
if (auditArgs.IsChanged)
567567
col.SetMapValue(d, val = auditArgs.Value);
568568
}
569569
if (_noneParameter)

FreeSql/Internal/CommonProvider/UpdateProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ public string ToSql()
610610
{
611611
var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Update, col, _table.Properties[col.CsName], val);
612612
_orm.Aop.AuditValue(this, auditArgs);
613-
if (auditArgs.Value != null)
613+
if (auditArgs.IsChanged)
614614
col.SetMapValue(_source.First(), val = auditArgs.Value);
615615
}
616616
if (_noneParameter)
@@ -656,7 +656,7 @@ public string ToSql()
656656
{
657657
var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Update, col, _table.Properties[col.CsName], val);
658658
_orm.Aop.AuditValue(this, auditArgs);
659-
if (auditArgs.Value != null)
659+
if (auditArgs.IsChanged)
660660
col.SetMapValue(_source.First(), val = auditArgs.Value);
661661
}
662662
if (_noneParameter)

Providers/FreeSql.Provider.Oracle/Curd/OracleInsert.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public override string ToSql()
7474
{
7575
var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Insert, col, _table.Properties[col.CsName], val);
7676
_orm.Aop.AuditValue(this, auditArgs);
77-
if (auditArgs.Value != null)
77+
if (auditArgs.IsChanged)
7878
col.SetMapValue(d, val = auditArgs.Value);
7979
}
8080
if (_noneParameter)

0 commit comments

Comments
 (0)