mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 增加 AuditValueEventArgs Object 参数;#1128
This commit is contained in:
@ -308,12 +308,13 @@ namespace FreeSql.Aop
|
||||
#region AuditValue
|
||||
public class AuditValueEventArgs : EventArgs
|
||||
{
|
||||
public AuditValueEventArgs(AuditValueType autoValueType, ColumnInfo column, PropertyInfo property, object value)
|
||||
public AuditValueEventArgs(AuditValueType autoValueType, ColumnInfo column, PropertyInfo property, object value, object obj)
|
||||
{
|
||||
this.AuditValueType = autoValueType;
|
||||
this.Column = column;
|
||||
this.Property = property;
|
||||
this._value = value;
|
||||
this.Object = obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -342,6 +343,7 @@ namespace FreeSql.Aop
|
||||
}
|
||||
private object _value;
|
||||
public bool ValueIsChanged { get; private set; }
|
||||
public object Object { get; }
|
||||
}
|
||||
public enum AuditValueType { Update, Insert, InsertOrUpdate }
|
||||
#endregion
|
||||
|
@ -93,7 +93,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
foreach (var col in table.Columns.Values)
|
||||
{
|
||||
object val = col.GetValue(data);
|
||||
var auditArgs = new Aop.AuditValueEventArgs(Aop.AuditValueType.InsertOrUpdate, col, table.Properties.TryGetValue(col.CsName, out var tryprop) ? tryprop : null, val);
|
||||
var auditArgs = new Aop.AuditValueEventArgs(Aop.AuditValueType.InsertOrUpdate, col, table.Properties.TryGetValue(col.CsName, out var tryprop) ? tryprop : null, val, data);
|
||||
orm.Aop.AuditValueHandler(sender, auditArgs);
|
||||
if (auditArgs.ValueIsChanged)
|
||||
{
|
||||
|
@ -167,7 +167,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
object val = col.GetValue(data);
|
||||
if (orm.Aop.AuditValueHandler != null)
|
||||
{
|
||||
var auditArgs = new Aop.AuditValueEventArgs(Aop.AuditValueType.Insert, col, table.Properties.TryGetValue(col.CsName, out var tryprop) ? tryprop : null, val);
|
||||
var auditArgs = new Aop.AuditValueEventArgs(Aop.AuditValueType.Insert, col, table.Properties.TryGetValue(col.CsName, out var tryprop) ? tryprop : null, val, data);
|
||||
orm.Aop.AuditValueHandler(sender, auditArgs);
|
||||
if (auditArgs.ValueIsChanged)
|
||||
{
|
||||
|
@ -410,7 +410,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
foreach (var col in table.Columns.Values)
|
||||
{
|
||||
object val = col.GetValue(d);
|
||||
var auditArgs = new Aop.AuditValueEventArgs(Aop.AuditValueType.Update, col, table.Properties.TryGetValue(col.CsName, out var tryprop) ? tryprop : null, val);
|
||||
var auditArgs = new Aop.AuditValueEventArgs(Aop.AuditValueType.Update, col, table.Properties.TryGetValue(col.CsName, out var tryprop) ? tryprop : null, val, d);
|
||||
orm.Aop.AuditValueHandler(sender, auditArgs);
|
||||
if (auditArgs.ValueIsChanged)
|
||||
{
|
||||
@ -432,7 +432,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
foreach (var col in table.Columns.Values)
|
||||
{
|
||||
object val = col.GetValue(data);
|
||||
var auditArgs = new Aop.AuditValueEventArgs(Aop.AuditValueType.Update, col, table.Properties.TryGetValue(col.CsName, out var tryprop) ? tryprop : null, val);
|
||||
var auditArgs = new Aop.AuditValueEventArgs(Aop.AuditValueType.Update, col, table.Properties.TryGetValue(col.CsName, out var tryprop) ? tryprop : null, val, data);
|
||||
orm.Aop.AuditValueHandler(sender, auditArgs);
|
||||
if (auditArgs.ValueIsChanged)
|
||||
{
|
||||
|
Reference in New Issue
Block a user