diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs index 807e52fa17..d71b97334a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCachedApplicationConfigurationClient.cs @@ -3,6 +3,7 @@ using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; using Volo.Abp.AspNetCore.Mvc.Client; using Volo.Abp.DependencyInjection; using Volo.Abp.Http.Client.DynamicProxying; +using Volo.Abp.MultiTenancy; namespace Volo.Abp.AspNetCore.Components.WebAssembly { @@ -17,17 +18,28 @@ namespace Volo.Abp.AspNetCore.Components.WebAssembly protected ApplicationConfigurationCache Cache { get; } + protected ICurrentTenantAccessor CurrentTenantAccessor { get; } + public WebAssemblyCachedApplicationConfigurationClient( IHttpClientProxy proxy, - ApplicationConfigurationCache cache) + ApplicationConfigurationCache cache, + ICurrentTenantAccessor currentTenantAccessor) { Proxy = proxy; Cache = cache; + CurrentTenantAccessor = currentTenantAccessor; } public virtual async Task InitializeAsync() { - Cache.Set(await Proxy.Service.GetAsync()); + var configurationDto = await Proxy.Service.GetAsync(); + + Cache.Set(configurationDto); + + CurrentTenantAccessor.Current = new BasicTenantInfo( + configurationDto.CurrentTenant.Id, + configurationDto.CurrentTenant.Name + ); } public virtual Task GetAsync() diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCurrentTenantAccessor.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCurrentTenantAccessor.cs new file mode 100644 index 0000000000..eb0ee781ad --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyCurrentTenantAccessor.cs @@ -0,0 +1,11 @@ +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.AspNetCore.Components.WebAssembly +{ + [Dependency(ReplaceServices = true)] + public class WebAssemblyCurrentTenantAccessor : ICurrentTenantAccessor, ISingletonDependency + { + public BasicTenantInfo Current { get; set; } + } +}