PhoneToolMX/PolyProv/Program.cs

36 lines
867 B
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
using PhoneToolMX.Data;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddDbContext<PTMXContext>(
options => options.UseNpgsql(builder.Configuration.GetConnectionString("DbConnection"),
b => b.MigrationsAssembly("PhoneToolMX.Models")));
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
if (!builder.Environment.IsDevelopment()) {
builder.Host.UseSystemd();
}
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment()) {
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{action}",
defaults: new { controller = "Config" });
app.Run();