- 增加 DbContextOptions.AuditValue 基于 Ioc Scoped 审计值;

This commit is contained in:
2881099
2024-01-29 09:17:49 +08:00
parent c74b202b54
commit 096ecdfb84
9 changed files with 417 additions and 9 deletions

View File

@ -1,4 +1,5 @@

using FreeSql.Internal.Model;
using System;
using System.Collections.Generic;
using System.Linq;
@ -47,5 +48,34 @@ namespace FreeSql
/// 实体变化事件
/// </summary>
public Action<List<DbContext.EntityChangeReport.ChangeInfo>> OnEntityChange { get; set; }
/// <summary>
/// DbContext/Repository 审计值事件,适合 Scoped IOC 中获取登陆信息
/// </summary>
public event EventHandler<DbContextAuditValueEventArgs> AuditValue;
public EventHandler<DbContextAuditValueEventArgs> AuditValueHandler => AuditValue;
}
public class DbContextAuditValueEventArgs : EventArgs
{
public DbContextAuditValueEventArgs(Aop.AuditValueType auditValueType, Type entityType, object obj)
{
this.AuditValueType = auditValueType;
this.EntityType = entityType;
this.Object = obj;
}
/// <summary>
/// 类型
/// </summary>
public Aop.AuditValueType AuditValueType { get; }
/// <summary>
/// 类型
/// </summary>
public Type EntityType { get; }
/// <summary>
/// 实体对象
/// </summary>
public object Object { get; }
}
}