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

View File

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

View File

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

View File

@@ -8,5 +8,8 @@ namespace Yi.Abp.SqlSugarCore
{ {
public class YiDbContext : SqlSugarDbContext public class YiDbContext : SqlSugarDbContext
{ {
public YiDbContext(IAbpLazyServiceProvider lazyServiceProvider) : base(lazyServiceProvider)
{
}
} }
} }