using Microsoft.EntityFrameworkCore; using RhSolutions.Models; using RhSolutions.Api.Services; var builder = WebApplication.CreateBuilder(args); string dbHost = builder.Configuration["DB_HOST"], dbPort = builder.Configuration["DB_PORT"], dbName = builder.Configuration["DB_DATABASE"], dbUser = builder.Configuration["DB_USER"], dbPassword = builder.Configuration["DB_PASSWORD"]; string connectionString = builder.Configuration["ConnectionsStrings:RhSolutionsLocal"] ?? $"Host={dbHost};Port={dbPort};Database={dbName};Username={dbUser};Password={dbPassword}"; builder.Services.AddDbContext(opts => { opts.UseNpgsql(connectionString); if (builder.Environment.IsDevelopment()) { opts.EnableSensitiveDataLogging(true); } }); builder.Services.AddScoped(); builder.Services.AddControllers(); var app = builder.Build(); app.MapControllers(); var context = app.Services.CreateScope().ServiceProvider .GetRequiredService(); app.Run();