Merge branch 'refs/heads/abp' into digital-collectibles

This commit is contained in:
chenchun
2024-11-20 13:44:30 +08:00
4 changed files with 20 additions and 2 deletions

View File

@@ -32,6 +32,9 @@ public class DefaultSqlSugarDbContext : SqlSugarDbContext
protected IEntityChangeEventHelper EntityChangeEventHelper =>
LazyServiceProvider.LazyGetService<IEntityChangeEventHelper>(NullEntityChangeEventHelper.Instance);
public DefaultSqlSugarDbContext(IAbpLazyServiceProvider lazyServiceProvider) : base(lazyServiceProvider)
{
}
protected override void CustomDataFilter(ISqlSugarClient sqlSugarClient)
{
if (IsSoftDeleteFilterEnabled)
@@ -204,4 +207,5 @@ public class DefaultSqlSugarDbContext : SqlSugarDbContext
entityColumnInfo.IsPrimarykey = true;
}
}
}

View File

@@ -7,8 +7,14 @@ namespace Yi.Framework.SqlSugarCore;
public abstract class SqlSugarDbContext : ISqlSugarDbContextDependencies
{
//属性注入
public IAbpLazyServiceProvider LazyServiceProvider { get; set; }
protected IAbpLazyServiceProvider LazyServiceProvider { get; }
public SqlSugarDbContext(IAbpLazyServiceProvider lazyServiceProvider)
{
this.LazyServiceProvider = lazyServiceProvider;
}
protected ISqlSugarClient SqlSugarClient { get;private set; }
public int ExecutionOrder => 0;

View File

@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Users;
using Yi.Framework.Rbac.Domain.Authorization;
using Yi.Framework.Rbac.Domain.Entities;
@@ -24,6 +25,9 @@ namespace Yi.Framework.Rbac.SqlSugarCore
}
public YiRbacDbContext(IAbpLazyServiceProvider lazyServiceProvider) : base(lazyServiceProvider)
{
}
/// <summary>
/// 数据权限过滤
/// </summary>
@@ -86,5 +90,6 @@ namespace Yi.Framework.Rbac.SqlSugarCore
sqlSugarClient.QueryFilter.AddTableFilter(expUser.ToExpression());
sqlSugarClient.QueryFilter.AddTableFilter(expRole.ToExpression());
}
}
}

View File

@@ -7,6 +7,9 @@ using Yi.Framework.SqlSugarCore;
namespace Yi.Abp.SqlSugarCore
{
public class YiDbContext : SqlSugarDbContext
{
public YiDbContext(IAbpLazyServiceProvider lazyServiceProvider) : base(lazyServiceProvider)
{
}
}
}