using Blazored.LocalStorage; using Microsoft.EntityFrameworkCore; using MudBlazor.Services; using SharpRSS.Blazor.Components; using SharpRSS.Business; using SharpRSS.Data; var builder = WebApplication.CreateBuilder(args); builder.UseSRSS(); builder.Services.AddBlazoredLocalStorage(); // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); builder.Services.AddMudServices(); builder.Services.AddHttpContextAccessor(); // HttpContext accessor var app = builder.Build(); var contextFactory = app.Services.GetService>(); if (contextFactory != null) { await using var context = await contextFactory.CreateDbContextAsync(); context.Database.EnsureCreated(); } // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error", createScopeForErrors: true); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAntiforgery(); app.MapRazorComponents() .AddInteractiveServerRenderMode(); app.Run();