public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add <App>("#app"); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); builder.Services.AddLocalization(); builder.Services.AddBlazorise(options => { options.ChangeTextOnKeyPress = true; }).AddBootstrapProviders().AddFontAwesomeIcons(); builder.Services.AddBlazoredModal(); builder.Services.AddToaster(config => { //example customizations config.PositionClass = Defaults.Classes.Position.BottomRight; config.PreventDuplicates = false; config.NewestOnTop = true; }); builder.Services.AddFileReaderService(options => options.InitializeOnFirstCall = true); builder.Services.AddScoped <IHttpService, HttpService>(); builder.Services.AddScoped <IAccountRepository, AccountRepository>(); builder.Services.AddScoped <ITagRepository, TagRepository>(); builder.Services.AddScoped <ICurrencyRepository, CurrencyRepository>(); builder.Services.AddScoped <ICountryRepository, CountryRepository>(); builder.Services.AddScoped <ICityRepository, CityRepository>(); builder.Services.AddScoped <ICategoryRepository, CategoryRepository>(); builder.Services.AddScoped <IUserCRepository, UserCRepository>(); builder.Services.AddScoped <IStoreRepository, StoreRepository>(); builder.Services.AddScoped <IStoreUserRepository, StoreUserRepository>(); builder.Services.AddScoped <IHomeRepository, HomeRepository>(); builder.Services.AddScoped <IErrorLogsRepository, ErrorLogsRepository>(); builder.Services.AddScoped <ILocalizationDB, LocalizationDB>(); builder.Services.AddScoped <IAuditRepository, AuditRepository>(); builder.Services.AddScoped <IMeasruingUnitRepository, MeasruingUnitRepository>(); builder.Services.AddScoped <IProductRepository, ProductRepository>(); builder.Services.AddScoped <IFavouriteRepository, FavouriteRepository>(); builder.Services.AddScoped <IOrderRepository, OrderRepository>(); builder.Services.AddScoped <IMessageRepository, MessageRepository>(); builder.Services.AddScoped <IRoleRepository, RoleRepository>(); builder.Services.AddScoped <IPaymentMethodRepository, PaymentMethodRepository>(); builder.Services.AddScoped <INotificationRepository, NotificationRepository>(); builder.Services.AddScoped <IUserABRepository, UserABRepository>(); builder.Services.AddScoped <IHomePageHeaderRepository, HomePageHeaderRepository>(); builder.Services.AddBlazoredLocalStorage(); //JWT builder.Services.AddAuthorizationCore(config => { config.AddPolicy(Policies.Audits, Policies.AuditsPolicy()); config.AddPolicy(Policies.Categories, Policies.CategoriesPolicy()); config.AddPolicy(Policies.Cities, Policies.CitiesPolicy()); config.AddPolicy(Policies.Countries, Policies.CountriesPolicy()); config.AddPolicy(Policies.Currencies, Policies.CurrenciesPolicy()); config.AddPolicy(Policies.ErrorLogs, Policies.ErrorLogsPolicy()); config.AddPolicy(Policies.MeasruingUnits, Policies.MeasruingUnitsPolicy()); config.AddPolicy(Policies.PaymentMethods, Policies.PaymentMethodsPolicy()); config.AddPolicy(Policies.Products, Policies.ProductsPolicy()); config.AddPolicy(Policies.Stores, Policies.StoresPolicy()); config.AddPolicy(Policies.Tags, Policies.TagsPolicy()); config.AddPolicy(Policies.UserAB, Policies.UserABPolicy()); config.AddPolicy(Policies.UserC, Policies.UserCPolicy()); config.AddPolicy(Policies.HangFire, Policies.HangFirePolicy()); config.AddPolicy(Policies.Swagger, Policies.SwaggerPolicy()); config.AddPolicy(Policies.Advertisements, Policies.AdvertisementsPolicy()); }); builder.Services.AddScoped <JWTAuthenticationStateProvider>(); builder.Services.AddScoped <AuthenticationStateProvider, JWTAuthenticationStateProvider>( provider => provider.GetRequiredService <JWTAuthenticationStateProvider>()); builder.Services.AddScoped <ILoginService, JWTAuthenticationStateProvider>( provider => provider.GetRequiredService <JWTAuthenticationStateProvider>()); builder.Services.AddScoped <TokenRenewer>(); var host = builder.Build(); await host.SetDefaultCulture(); host.Services.UseBootstrapProviders().UseFontAwesomeIcons(); await host.RunAsync(); }