public static WebAssemblyHostBuilder AddClientServices(this WebAssemblyHostBuilder builder)
        {
            builder
            .Services
            .AddAuthorizationCore(options =>
            {
                foreach (var permissionModule in PermissionModules.GetAllPermissionsModules())
                {
                    RegisterPermissionClaimPolicyByModule(options, permissionModule);
                }
            })
            .AddBlazoredLocalStorage()
            .AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies())
            .AddMudServices(
                configuration =>
            {
                configuration.SnackbarConfiguration.PositionClass          = Defaults.Classes.Position.BottomRight;
                configuration.SnackbarConfiguration.HideTransitionDuration = 100;
                configuration.SnackbarConfiguration.ShowTransitionDuration = 100;
                configuration.SnackbarConfiguration.VisibleStateDuration   = 3000;
                configuration.SnackbarConfiguration.ShowCloseIcon          = false;
            })
            .AddScoped <EntityGBlazorStateProvider>()
            .AddScoped <AuthenticationStateProvider, EntityGBlazorStateProvider>()
            .AddManagers()
            .AddTransient <AuthenticationHeaderHandler>()
            .AddScoped(sp => sp
                       .GetRequiredService <IHttpClientFactory>()
                       .CreateClient(ClientName).EnableIntercept(sp))
            .AddHttpClient(ClientName, client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
            .AddHttpMessageHandler <AuthenticationHeaderHandler>();

            builder.Services.AddScoped(sp => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });
            builder.Services.AddAntDesign();
            builder.Services.Configure <ProSettings>(builder.Configuration.GetSection("ProSettings"));
            builder.Services.AddScoped <IChartService, ChartService>();
            builder.Services.AddScoped <IProjectService, ProjectService>();
            builder.Services.AddScoped <IUserService, UserService>();
            builder.Services.AddScoped <IAccountService, AccountService>();
            builder.Services.AddScoped <IProfileService, ProfileService>();

            builder.Services.AddHttpClientInterceptor();
            return(builder);
        }
 public static WebAssemblyHostBuilder AddClientServices(this WebAssemblyHostBuilder builder)
 {
     builder
     .Services
     .AddLocalization(options =>
     {
         options.ResourcesPath = "Resources";
     })
     .AddAuthorizationCore(options =>
     {
         foreach (var permissionModule in PermissionModules.GetAllPermissionsModules())
         {
             RegisterPermissionClaimPolicyByModule(options, permissionModule);
         }
     })
     .AddBlazoredLocalStorage()
     .AddMudServices(configuration =>
     {
         configuration.SnackbarConfiguration.PositionClass          = Defaults.Classes.Position.BottomRight;
         configuration.SnackbarConfiguration.HideTransitionDuration = 100;
         configuration.SnackbarConfiguration.ShowTransitionDuration = 100;
         configuration.SnackbarConfiguration.VisibleStateDuration   = 3000;
         configuration.SnackbarConfiguration.ShowCloseIcon          = false;
     })
     .AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies())
     .AddScoped <ClientPreferenceManager>()
     .AddScoped <BlazorHeroStateProvider>()
     .AddScoped <AuthenticationStateProvider, BlazorHeroStateProvider>()
     .AddManagers()
     .AddTransient <AuthenticationHeaderHandler>()
     .AddScoped(sp => sp
                .GetRequiredService <IHttpClientFactory>()
                .CreateClient(ClientName).EnableIntercept(sp))
     .AddHttpClient(ClientName, client =>
     {
         client.DefaultRequestHeaders.AcceptLanguage.Clear();
         client.DefaultRequestHeaders.AcceptLanguage.ParseAdd(CultureInfo.DefaultThreadCurrentCulture?.TwoLetterISOLanguageName);
         client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress);
     })
     .AddHttpMessageHandler <AuthenticationHeaderHandler>();
     builder.Services.AddHttpClientInterceptor();
     return(builder);
 }
 public static WebAssemblyHostBuilder AddClientServices(this WebAssemblyHostBuilder builder)
 {
     builder
     .Services
     .AddAuthorizationCore(options =>
     {
         foreach (var permissionModule in PermissionModules.GetAllPermissionsModules())
         {
             RegisterPermissionClaimPolicyByModule(options, permissionModule);
         }
     })
     .AddBlazoredLocalStorage()
     .AddLocalization(options =>
     {
         options.ResourcesPath = "Resources";
     })
     .AddMudServices(
         configuration =>
     {
         configuration.SnackbarConfiguration.PositionClass          = Defaults.Classes.Position.BottomRight;
         configuration.SnackbarConfiguration.HideTransitionDuration = 100;
         configuration.SnackbarConfiguration.ShowTransitionDuration = 100;
         configuration.SnackbarConfiguration.VisibleStateDuration   = 3000;
         configuration.SnackbarConfiguration.ShowCloseIcon          = false;
     })
     .AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies())
     .AddScoped <PreferenceManager>()
     .AddScoped <BlazorHeroStateProvider>()
     .AddScoped <AuthenticationStateProvider, BlazorHeroStateProvider>()
     .AddManagers()
     .AddTransient <AuthenticationHeaderHandler>()
     .AddScoped(sp => sp
                .GetRequiredService <IHttpClientFactory>()
                .CreateClient(ClientName))
     .AddHttpClient(ClientName, client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
     .AddTransientHttpErrorPolicy(policy => policy.WaitAndRetryAsync(3, _ => TimeSpan.FromSeconds(2)))
     .AddHttpMessageHandler <AuthenticationHeaderHandler>();
     return(builder);
 }