Browse Source

Move ICachedApplicationConfigurationClient initialization to a better place.

pull/5399/head
Halil İbrahim Kalkan 6 years ago
parent
commit
4be899f7a7
  1. 9
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/App.razor
  2. 8
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Program.cs

9
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/App.razor

@ -1,6 +1,4 @@
@using Volo.Abp.AspNetCore.Mvc.Client
@using Volo.Abp.Identity.Blazor.Pages @using Volo.Abp.Identity.Blazor.Pages
@inject ICachedApplicationConfigurationClient ConfigurationClient
<CascadingAuthenticationState> <CascadingAuthenticationState>
<Router <Router
AppAssembly="@typeof(Program).Assembly" AppAssembly="@typeof(Program).Assembly"
@ -26,10 +24,3 @@
</NotFound> </NotFound>
</Router> </Router>
</CascadingAuthenticationState> </CascadingAuthenticationState>
@code
{
protected override async Task OnInitializedAsync()
{
await ConfigurationClient.InitializeAsync();
}
}

8
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Program.cs

@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc.Client;
namespace MyCompanyName.MyProjectName.Blazor namespace MyCompanyName.MyProjectName.Blazor
{ {
@ -28,6 +29,13 @@ namespace MyCompanyName.MyProjectName.Blazor
application.Initialize(host.Services); application.Initialize(host.Services);
using (var scope = host.Services.CreateScope())
{
await scope.ServiceProvider
.GetRequiredService<ICachedApplicationConfigurationClient>()
.InitializeAsync();
}
await host.RunAsync(); await host.RunAsync();
} }
} }

Loading…
Cancel
Save