/
h0tnanny
/
DeliveryService
Обзор
Документация
Войти
/
h0tnanny
/
DeliveryService
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
DeliveryService.RazorApp/Program.cs
48 строк
1 KB
Хатнянский Максим
add razor pages
13 мар 2024, 20:33
13 мар 2024, 20:33
570f7a3
Код
Авторство
О чём код?
using DeliveryService.Persistence; using Microsoft.EntityFrameworkCore; namespace DeliveryService.RazorApp; public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); builder.Logging.ClearProviders(); builder.Logging.AddConsole(); // Add services to the container. builder.Services.AddRazorPages(); builder.Services.AddDbContext<DeliveryDbContext>(options => { options.UseNpgsql(builder.Configuration.GetConnectionString("postgres")) .EnableSensitiveDataLogging() .EnableDetailedErrors() .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); }); var app = builder.Build(); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error"); // 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.UseRouting(); app.UseAuthorization(); app.MapRazorPages(); app.Run(); } }