Make ICurrentTenant working for the Blazor UI

pull/5614/head
Halil İbrahim Kalkan 5 years ago
parent 70e29ab2d8
commit 991538fea4

@ -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<IAbpApplicationConfigurationAppService> 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<ApplicationConfigurationDto> GetAsync()

@ -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; }
}
}
Loading…
Cancel
Save