maliming
4 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
6 changed files with
52 additions and
6 deletions
-
modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainModule.cs
-
modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo/Abp/FeatureManagement/EntityFrameworkCore/AbpFeatureManagementEntityFrameworkCoreTestModule.cs
-
modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDomainModule.cs
-
modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionDefinitionRecordRepository_Tests.cs
-
modules/permission-management/test/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementEntityFrameworkCoreTestModule.cs
-
modules/permission-management/test/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests/Volo/Abp/PermissionManagement/EntityFrameworkCore/EFCorePermissionDefinitionRecordRepository_Tests.cs
|
|
|
@ -52,6 +52,7 @@ public class AbpFeatureManagementDomainModule : AbpModule |
|
|
|
} |
|
|
|
|
|
|
|
private readonly CancellationTokenSource _cancellationTokenSource = new(); |
|
|
|
private Task _initializeDynamicFeaturesTask; |
|
|
|
|
|
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
|
|
{ |
|
|
|
@ -70,6 +71,11 @@ public class AbpFeatureManagementDomainModule : AbpModule |
|
|
|
return Task.CompletedTask; |
|
|
|
} |
|
|
|
|
|
|
|
public Task GetInitializeDynamicFeaturesTask() |
|
|
|
{ |
|
|
|
return _initializeDynamicFeaturesTask ?? Task.CompletedTask; |
|
|
|
} |
|
|
|
|
|
|
|
private void InitializeDynamicFeatures(ApplicationInitializationContext context) |
|
|
|
{ |
|
|
|
var options = context |
|
|
|
@ -84,7 +90,7 @@ public class AbpFeatureManagementDomainModule : AbpModule |
|
|
|
|
|
|
|
var rootServiceProvider = context.ServiceProvider.GetRequiredService<IRootServiceProvider>(); |
|
|
|
|
|
|
|
Task.Run(async () => |
|
|
|
_initializeDynamicFeaturesTask = Task.Run(async () => |
|
|
|
{ |
|
|
|
using var scope = rootServiceProvider.CreateScope(); |
|
|
|
var applicationLifetime = scope.ServiceProvider.GetService<IHostApplicationLifetime>(); |
|
|
|
|
|
|
|
@ -1,10 +1,13 @@ |
|
|
|
using Microsoft.Data.Sqlite; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.Data.Sqlite; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure; |
|
|
|
using Microsoft.EntityFrameworkCore.Storage; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.EntityFrameworkCore; |
|
|
|
using Volo.Abp.EntityFrameworkCore.Sqlite; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
using Volo.Abp.Threading; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
|
|
|
|
namespace Volo.Abp.FeatureManagement.EntityFrameworkCore; |
|
|
|
@ -42,4 +45,18 @@ public class AbpFeatureManagementEntityFrameworkCoreTestModule : AbpModule |
|
|
|
|
|
|
|
return connection; |
|
|
|
} |
|
|
|
|
|
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
|
|
{ |
|
|
|
var task = context.ServiceProvider.GetRequiredService<AbpFeatureManagementDomainModule>().GetInitializeDynamicFeaturesTask(); |
|
|
|
if (!task.IsCompleted) |
|
|
|
{ |
|
|
|
AsyncHelper.RunSync(() => Awaited(task)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private async static Task Awaited(Task task) |
|
|
|
{ |
|
|
|
await task; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -26,7 +26,7 @@ namespace Volo.Abp.PermissionManagement; |
|
|
|
public class AbpPermissionManagementDomainModule : AbpModule |
|
|
|
{ |
|
|
|
private readonly CancellationTokenSource _cancellationTokenSource = new(); |
|
|
|
|
|
|
|
private Task _initializeDynamicPermissionsTask; |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
if (context.Services.IsDataMigrationEnvironment()) |
|
|
|
@ -56,6 +56,11 @@ public class AbpPermissionManagementDomainModule : AbpModule |
|
|
|
return Task.CompletedTask; |
|
|
|
} |
|
|
|
|
|
|
|
public Task GetInitializeDynamicPermissionsTask() |
|
|
|
{ |
|
|
|
return _initializeDynamicPermissionsTask ?? Task.CompletedTask; |
|
|
|
} |
|
|
|
|
|
|
|
private void InitializeDynamicPermissions(ApplicationInitializationContext context) |
|
|
|
{ |
|
|
|
var options = context |
|
|
|
@ -70,7 +75,7 @@ public class AbpPermissionManagementDomainModule : AbpModule |
|
|
|
|
|
|
|
var rootServiceProvider = context.ServiceProvider.GetRequiredService<IRootServiceProvider>(); |
|
|
|
|
|
|
|
Task.Run(async () => |
|
|
|
_initializeDynamicPermissionsTask = Task.Run(async () => |
|
|
|
{ |
|
|
|
using var scope = rootServiceProvider.CreateScope(); |
|
|
|
var applicationLifetime = scope.ServiceProvider.GetService<IHostApplicationLifetime>(); |
|
|
|
|
|
|
|
@ -1,10 +1,12 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Shouldly; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
using Xunit; |
|
|
|
|
|
|
|
namespace Volo.Abp.PermissionManagement; |
|
|
|
|
|
|
|
public abstract class PermissionDefinitionRecordRepository_Tests : PermissionTestBase |
|
|
|
public abstract class PermissionDefinitionRecordRepository_Tests<TStartupModule> : PermissionManagementTestBase<TStartupModule> |
|
|
|
where TStartupModule : IAbpModule |
|
|
|
{ |
|
|
|
protected IPermissionDefinitionRecordRepository PermissionDefinitionRecordRepository { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
@ -1,8 +1,10 @@ |
|
|
|
using System; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Volo.Abp.EntityFrameworkCore; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
using Volo.Abp.Threading; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
|
|
|
|
namespace Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
|
@ -28,4 +30,18 @@ public class AbpPermissionManagementEntityFrameworkCoreTestModule : AbpModule |
|
|
|
|
|
|
|
context.Services.AddAlwaysDisableUnitOfWorkTransaction(); |
|
|
|
} |
|
|
|
|
|
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
|
|
{ |
|
|
|
var task = context.ServiceProvider.GetRequiredService<AbpPermissionManagementDomainModule>().GetInitializeDynamicPermissionsTask(); |
|
|
|
if (!task.IsCompleted) |
|
|
|
{ |
|
|
|
AsyncHelper.RunSync(() => Awaited(task)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private async static Task Awaited(Task task) |
|
|
|
{ |
|
|
|
await task; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
namespace Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
|
|
|
|
|
public class EFCorePermissionDefinitionRecordRepository_Tests : PermissionDefinitionRecordRepository_Tests |
|
|
|
public class EFCorePermissionDefinitionRecordRepository_Tests : PermissionDefinitionRecordRepository_Tests<AbpPermissionManagementEntityFrameworkCoreTestModule> |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|