2024-06-16 21:09:49 +02:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2024-06-17 13:53:48 +02:00
|
|
|
using MudBlazor.Services;
|
2024-06-16 17:20:30 +02:00
|
|
|
using SharpRSS.Blazor.Components;
|
2024-06-16 21:09:49 +02:00
|
|
|
using SharpRSS.Business;
|
|
|
|
using SharpRSS.Data;
|
2024-06-16 17:20:30 +02:00
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
2024-06-16 21:09:49 +02:00
|
|
|
builder.UseSRSS();
|
|
|
|
|
2024-06-16 17:20:30 +02:00
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddRazorComponents()
|
|
|
|
.AddInteractiveServerComponents();
|
2024-06-17 13:53:48 +02:00
|
|
|
builder.Services.AddMudServices();
|
2024-07-03 20:17:44 +02:00
|
|
|
builder.Services.AddHttpContextAccessor(); // HttpContext accessor
|
2024-06-16 17:20:30 +02:00
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
2024-06-16 21:09:49 +02:00
|
|
|
var contextFactory = app.Services.GetService<IDbContextFactory<SRSSContext>>();
|
|
|
|
if (contextFactory != null)
|
|
|
|
{
|
|
|
|
await using var context = await contextFactory.CreateDbContextAsync();
|
|
|
|
context.Database.EnsureCreated();
|
|
|
|
}
|
|
|
|
|
2024-06-16 17:20:30 +02:00
|
|
|
// 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<App>()
|
|
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
|
|
|
|
app.Run();
|