- 增加 Aop.AuditValue 事件,在插入/更新数据时审计属性值;

This commit is contained in:
28810 2019-08-25 18:19:31 +08:00
parent b57d35ae9b
commit 33612bd8bd
4 changed files with 5 additions and 5 deletions

View File

@ -306,7 +306,7 @@ namespace FreeSql.Aop
} }
} }
private object _value; private object _value;
internal bool IsChanged { get; private set; } public bool IsChanged { get; private set; }
} }
public enum AutoValueType { Update, Insert } public enum AutoValueType { Update, Insert }
} }

View File

@ -563,7 +563,7 @@ namespace FreeSql.Internal.CommonProvider
{ {
var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Insert, col, _table.Properties[col.CsName], val); var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Insert, col, _table.Properties[col.CsName], val);
_orm.Aop.AuditValue(this, auditArgs); _orm.Aop.AuditValue(this, auditArgs);
if (auditArgs.Value != null) if (auditArgs.IsChanged)
col.SetMapValue(d, val = auditArgs.Value); col.SetMapValue(d, val = auditArgs.Value);
} }
if (_noneParameter) if (_noneParameter)

View File

@ -610,7 +610,7 @@ namespace FreeSql.Internal.CommonProvider
{ {
var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Update, col, _table.Properties[col.CsName], val); var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Update, col, _table.Properties[col.CsName], val);
_orm.Aop.AuditValue(this, auditArgs); _orm.Aop.AuditValue(this, auditArgs);
if (auditArgs.Value != null) if (auditArgs.IsChanged)
col.SetMapValue(_source.First(), val = auditArgs.Value); col.SetMapValue(_source.First(), val = auditArgs.Value);
} }
if (_noneParameter) if (_noneParameter)
@ -656,7 +656,7 @@ namespace FreeSql.Internal.CommonProvider
{ {
var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Update, col, _table.Properties[col.CsName], val); var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Update, col, _table.Properties[col.CsName], val);
_orm.Aop.AuditValue(this, auditArgs); _orm.Aop.AuditValue(this, auditArgs);
if (auditArgs.Value != null) if (auditArgs.IsChanged)
col.SetMapValue(_source.First(), val = auditArgs.Value); col.SetMapValue(_source.First(), val = auditArgs.Value);
} }
if (_noneParameter) if (_noneParameter)

View File

@ -74,7 +74,7 @@ namespace FreeSql.Oracle.Curd
{ {
var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Insert, col, _table.Properties[col.CsName], val); var auditArgs = new Aop.AuditValueEventArgs(Aop.AutoValueType.Insert, col, _table.Properties[col.CsName], val);
_orm.Aop.AuditValue(this, auditArgs); _orm.Aop.AuditValue(this, auditArgs);
if (auditArgs.Value != null) if (auditArgs.IsChanged)
col.SetMapValue(d, val = auditArgs.Value); col.SetMapValue(d, val = auditArgs.Value);
} }
if (_noneParameter) if (_noneParameter)