Created
February 3, 2020 21:19
-
-
Save gavilanch/9ad720d843b6ea211f2384c870c5c867 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Blazor.FileReader; | |
| using BlazorMovies.Client.Auth; | |
| using BlazorMovies.Client.Helpers; | |
| using BlazorMovies.Client.Repository; | |
| using Microsoft.AspNetCore.Blazor.Hosting; | |
| using Microsoft.AspNetCore.Components.Authorization; | |
| using Microsoft.Extensions.DependencyInjection; | |
| using System.Threading.Tasks; | |
| namespace BlazorMovies.Client | |
| { | |
| public class Program | |
| { | |
| public static async Task Main(string[] args) | |
| { | |
| var builder = WebAssemblyHostBuilder.CreateDefault(args); | |
| builder.RootComponents.Add<App>("app"); | |
| ConfigureServices(builder); | |
| await builder.Build().RunAsync(); | |
| } | |
| private static void ConfigureServices(WebAssemblyHostBuilder builder) | |
| { | |
| builder.Services.AddOptions(); | |
| builder.Services.AddTransient<IRepository, RepositoryInMemory>(); | |
| builder.Services.AddScoped<IHttpService, HttpService>(); | |
| builder.Services.AddScoped<IGenreRepository, GenreRepository>(); | |
| builder.Services.AddScoped<IPersonRepository, PersonRepository>(); | |
| builder.Services.AddScoped<IMoviesRepository, MoviesRepository>(); | |
| builder.Services.AddScoped<IAccountsRepository, AccountsRepository>(); | |
| builder.Services.AddScoped<IRatingRepository, RatingRepository>(); | |
| builder.Services.AddScoped<IDisplayMessage, DisplayMessage>(); | |
| builder.Services.AddScoped<IUsersRepository, UserRepository>(); | |
| builder.Services.AddFileReaderService(options => options.InitializeOnFirstCall = true); | |
| builder.Services.AddAuthorizationCore(); | |
| builder.Services.AddScoped<JWTAuthenticationStateProvider>(); | |
| builder.Services.AddScoped<AuthenticationStateProvider, JWTAuthenticationStateProvider>( | |
| provider => provider.GetRequiredService<JWTAuthenticationStateProvider>() | |
| ); | |
| builder.Services.AddScoped<ILoginService, JWTAuthenticationStateProvider>( | |
| provider => provider.GetRequiredService<JWTAuthenticationStateProvider>() | |
| ); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment