Browse Source
Merge pull request #9438 from abpframework/issue-9437
Implemented: Invalidate client configuration cache for blazor server-side apps
pull/9442/head
Halil İbrahim Kalkan
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
73 additions and
1 deletions
-
framework/src/Volo.Abp.AspNetCore.Components.Server/Volo.Abp.AspNetCore.Components.Server.csproj
-
framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/AbpAspNetCoreComponentsServerModule.cs
-
framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/Configuration/BlazorServerCurrentApplicationConfigurationCacheResetService.cs
-
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Configuration/ICurrentApplicationConfigurationCacheResetService.cs
-
framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/Configuration/NullCurrentApplicationConfigurationCacheResetService.cs
-
modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components/FeatureManagementModal.razor.cs
-
modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor/Components/PermissionManagementModal.razor.cs
-
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor.cs
|
|
|
@ -12,6 +12,8 @@ |
|
|
|
|
|
|
|
<ItemGroup> |
|
|
|
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.Web\Volo.Abp.AspNetCore.Components.Web.csproj" /> |
|
|
|
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.Contracts\Volo.Abp.AspNetCore.Mvc.Contracts.csproj" /> |
|
|
|
<ProjectReference Include="..\Volo.Abp.EventBus\Volo.Abp.EventBus.csproj" /> |
|
|
|
<ProjectReference Include="..\Volo.Abp.Http.Client\Volo.Abp.Http.Client.csproj" /> |
|
|
|
<ProjectReference Include="..\Volo.Abp.AspNetCore.SignalR\Volo.Abp.AspNetCore.SignalR.csproj" /> |
|
|
|
</ItemGroup> |
|
|
|
|
|
|
|
@ -5,8 +5,10 @@ using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.FileProviders; |
|
|
|
using Volo.Abp.AspNetCore.Auditing; |
|
|
|
using Volo.Abp.AspNetCore.Components.Web; |
|
|
|
using Volo.Abp.AspNetCore.Mvc; |
|
|
|
using Volo.Abp.AspNetCore.SignalR; |
|
|
|
using Volo.Abp.AspNetCore.Uow; |
|
|
|
using Volo.Abp.EventBus; |
|
|
|
using Volo.Abp.Http.Client; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
|
|
|
|
@ -15,7 +17,9 @@ namespace Volo.Abp.AspNetCore.Components.Server |
|
|
|
[DependsOn( |
|
|
|
typeof(AbpHttpClientModule), |
|
|
|
typeof(AbpAspNetCoreComponentsWebModule), |
|
|
|
typeof(AbpAspNetCoreSignalRModule) |
|
|
|
typeof(AbpAspNetCoreSignalRModule), |
|
|
|
typeof(AbpEventBusModule), |
|
|
|
typeof(AbpAspNetCoreMvcContractsModule) |
|
|
|
)] |
|
|
|
public class AbpAspNetCoreComponentsServerModule : AbpModule |
|
|
|
{ |
|
|
|
|
|
|
|
@ -0,0 +1,29 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp.AspNetCore.Components.Web.Configuration; |
|
|
|
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
using Volo.Abp.EventBus.Local; |
|
|
|
|
|
|
|
namespace Volo.Abp.AspNetCore.Components.Server.Configuration |
|
|
|
{ |
|
|
|
[Dependency(ReplaceServices = true)] |
|
|
|
public class BlazorServerCurrentApplicationConfigurationCacheResetService : |
|
|
|
ICurrentApplicationConfigurationCacheResetService, |
|
|
|
ITransientDependency |
|
|
|
{ |
|
|
|
private readonly ILocalEventBus _localEventBus; |
|
|
|
|
|
|
|
public BlazorServerCurrentApplicationConfigurationCacheResetService( |
|
|
|
ILocalEventBus localEventBus) |
|
|
|
{ |
|
|
|
_localEventBus = localEventBus; |
|
|
|
} |
|
|
|
|
|
|
|
public async Task ResetAsync() |
|
|
|
{ |
|
|
|
await _localEventBus.PublishAsync( |
|
|
|
new CurrentApplicationConfigurationCacheResetEventData() |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -0,0 +1,9 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
namespace Volo.Abp.AspNetCore.Components.Web.Configuration |
|
|
|
{ |
|
|
|
public interface ICurrentApplicationConfigurationCacheResetService |
|
|
|
{ |
|
|
|
Task ResetAsync(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -0,0 +1,13 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
|
|
|
|
namespace Volo.Abp.AspNetCore.Components.Web.Configuration |
|
|
|
{ |
|
|
|
public class NullCurrentApplicationConfigurationCacheResetService : ICurrentApplicationConfigurationCacheResetService, ISingletonDependency |
|
|
|
{ |
|
|
|
public Task ResetAsync() |
|
|
|
{ |
|
|
|
return Task.CompletedTask; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Components; |
|
|
|
using Microsoft.Extensions.Localization; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using Volo.Abp.AspNetCore.Components.Messages; |
|
|
|
using Volo.Abp.AspNetCore.Components.Web.Configuration; |
|
|
|
using Volo.Abp.Features; |
|
|
|
using Volo.Abp.Localization; |
|
|
|
using Volo.Abp.Validation.StringValues; |
|
|
|
@ -23,6 +24,8 @@ namespace Volo.Abp.FeatureManagement.Blazor.Components |
|
|
|
[Inject] protected IStringLocalizerFactory HtmlLocalizerFactory { get; set; } |
|
|
|
|
|
|
|
[Inject] protected IOptions<AbpLocalizationOptions> LocalizationOptions { get; set; } |
|
|
|
|
|
|
|
[Inject] private ICurrentApplicationConfigurationCacheResetService CurrentApplicationConfigurationCacheResetService { get; set; } |
|
|
|
|
|
|
|
protected Modal Modal; |
|
|
|
|
|
|
|
@ -101,6 +104,8 @@ namespace Volo.Abp.FeatureManagement.Blazor.Components |
|
|
|
|
|
|
|
await FeatureAppService.UpdateAsync(ProviderName, ProviderKey, features); |
|
|
|
|
|
|
|
await CurrentApplicationConfigurationCacheResetService.ResetAsync(); |
|
|
|
|
|
|
|
await InvokeAsync(Modal.Hide); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
|
|
|
|
@ -4,6 +4,7 @@ using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Blazorise; |
|
|
|
using Microsoft.AspNetCore.Components; |
|
|
|
using Volo.Abp.AspNetCore.Components.Web.Configuration; |
|
|
|
using Volo.Abp.PermissionManagement.Localization; |
|
|
|
|
|
|
|
namespace Volo.Abp.PermissionManagement.Blazor.Components |
|
|
|
@ -11,6 +12,7 @@ namespace Volo.Abp.PermissionManagement.Blazor.Components |
|
|
|
public partial class PermissionManagementModal |
|
|
|
{ |
|
|
|
[Inject] private IPermissionAppService PermissionAppService { get; set; } |
|
|
|
[Inject] private ICurrentApplicationConfigurationCacheResetService CurrentApplicationConfigurationCacheResetService { get; set; } |
|
|
|
|
|
|
|
private Modal _modal; |
|
|
|
|
|
|
|
@ -133,6 +135,8 @@ namespace Volo.Abp.PermissionManagement.Blazor.Components |
|
|
|
|
|
|
|
await PermissionAppService.UpdateAsync(_providerName, _providerKey, updateDto); |
|
|
|
|
|
|
|
await CurrentApplicationConfigurationCacheResetService.ResetAsync(); |
|
|
|
|
|
|
|
await InvokeAsync(_modal.Hide); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
|
|
|
|
@ -3,6 +3,7 @@ using System.Threading.Tasks; |
|
|
|
using Blazorise; |
|
|
|
using Microsoft.AspNetCore.Components; |
|
|
|
using Volo.Abp.AspNetCore.Components.Messages; |
|
|
|
using Volo.Abp.AspNetCore.Components.Web.Configuration; |
|
|
|
using Volo.Abp.SettingManagement.Localization; |
|
|
|
|
|
|
|
namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement.EmailSettingGroup |
|
|
|
@ -11,6 +12,9 @@ namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement.EmailSetting |
|
|
|
{ |
|
|
|
[Inject] |
|
|
|
protected IEmailSettingsAppService EmailSettingsAppService { get; set; } |
|
|
|
|
|
|
|
[Inject] |
|
|
|
private ICurrentApplicationConfigurationCacheResetService CurrentApplicationConfigurationCacheResetService { get; set; } |
|
|
|
|
|
|
|
[Inject] |
|
|
|
protected IUiMessageService UiMessageService { get; set; } |
|
|
|
@ -42,6 +46,8 @@ namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement.EmailSetting |
|
|
|
try |
|
|
|
{ |
|
|
|
await EmailSettingsAppService.UpdateAsync(ObjectMapper.Map<EmailSettingsDto, UpdateEmailSettingsDto>(EmailSettings)); |
|
|
|
|
|
|
|
await CurrentApplicationConfigurationCacheResetService.ResetAsync(); |
|
|
|
|
|
|
|
await UiMessageService.Success(L["SuccessfullySaved"]); |
|
|
|
} |
|
|
|
|