1
0
Fork 0
netddi/Program.cs

37 lines
1,011 B
C#
Raw Normal View History

2025-01-29 23:26:50 +01:00
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using netddi.Data;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlite(connectionString));
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>();
builder.Services.AddRazorPages();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseMigrationsEndPoint();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseRouting();
app.UseAuthorization();
2025-01-29 23:53:57 +01:00
app.UseStaticFiles();
app.MapRazorPages();
2025-01-29 23:26:50 +01:00
app.Run();