refactor: ai+人工重构优化 framework

This commit is contained in:
橙子
2025-02-23 03:06:06 +08:00
parent f9341fd2ac
commit 3e07ca822a
61 changed files with 2604 additions and 1260 deletions

View File

@@ -5,44 +5,78 @@ using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.SqlSugarCore;
/// <summary>
/// SqlSugar数据库上下文基类
/// </summary>
public abstract class SqlSugarDbContext : ISqlSugarDbContextDependencies
{
/// <summary>
/// 服务提供者
/// </summary>
protected IAbpLazyServiceProvider LazyServiceProvider { get; }
public SqlSugarDbContext(IAbpLazyServiceProvider lazyServiceProvider)
/// <summary>
/// 数据库客户端实例
/// </summary>
protected ISqlSugarClient SqlSugarClient { get; private set; }
/// <summary>
/// 执行顺序
/// </summary>
public virtual int ExecutionOrder => 0;
protected SqlSugarDbContext(IAbpLazyServiceProvider lazyServiceProvider)
{
this.LazyServiceProvider = lazyServiceProvider;
LazyServiceProvider = lazyServiceProvider;
}
protected ISqlSugarClient SqlSugarClient { get;private set; }
public int ExecutionOrder => 0;
public void OnSqlSugarClientConfig(ISqlSugarClient sqlSugarClient)
/// <summary>
/// 配置SqlSugar客户端
/// </summary>
public virtual void OnSqlSugarClientConfig(ISqlSugarClient sqlSugarClient)
{
SqlSugarClient = sqlSugarClient;
CustomDataFilter(sqlSugarClient);
}
/// <summary>
/// 自定义数据过滤器
/// </summary>
protected virtual void CustomDataFilter(ISqlSugarClient sqlSugarClient)
{
}
/// <summary>
/// 数据执行后事件
/// </summary>
public virtual void DataExecuted(object oldValue, DataAfterModel entityInfo)
{
}
/// <summary>
/// 数据执行前事件
/// </summary>
public virtual void DataExecuting(object oldValue, DataFilterModel entityInfo)
{
}
/// <summary>
/// SQL执行前事件
/// </summary>
public virtual void OnLogExecuting(string sql, SugarParameter[] pars)
{
}
/// <summary>
/// SQL执行后事件
/// </summary>
public virtual void OnLogExecuted(string sql, SugarParameter[] pars)
{
}
/// <summary>
/// 实体服务配置
/// </summary>
public virtual void EntityService(PropertyInfo propertyInfo, EntityColumnInfo entityColumnInfo)
{
}