using Microsoft.EntityFrameworkCore; using RhSolutions.Models; using RhSolutions.Api.Services; using RhSolutions.Api.Middleware; using RhSolutions.QueryModifiers; using RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings; using RhSolutions.QueryModifiers.DrinkingWaterHeatingPipes; var builder = WebApplication.CreateBuilder(args); string dbHost = builder.Configuration["DB_HOST"] ?? "localhost", dbPort = builder.Configuration["DB_PORT"] ?? "5000", dbName = builder.Configuration["DB_DATABASE"] ?? "rhsolutions", dbUser = builder.Configuration["DB_USER"] ?? "chebser", dbPassword = builder.Configuration["DB_PASSWORD"] ?? "Rehau-987"; 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() .AddScoped(); builder.Services.AddControllers(); builder.Services.AddKeyedScoped("Монтажная гильза") .AddKeyedScoped("Желоб") .AddKeyedScoped("Тройник RAUTITAN") .AddKeyedScoped("Тройник RAUTITAN резьбовой наружный") .AddKeyedScoped("Тройник RAUTITAN резьбовой внутренний") .AddKeyedScoped("Переходник на наружную резьбу") .AddKeyedScoped("Переходник на внутреннюю резьбу") .AddKeyedScoped("Переходник с накидной гайкой") .AddKeyedScoped("Угольник с наружной резьбой") .AddKeyedScoped("Угольник с внутренней резьбой") .AddKeyedScoped("Угольник настенный наружный") .AddKeyedScoped("Угольник настенный внутренний") .AddKeyedScoped("Проточный настенный угольник") .AddKeyedScoped("Угольник с накидной гайкой") .AddKeyedScoped("Муфта соединительная") .AddKeyedScoped("Угольник RAUTITAN") .AddKeyedScoped("Фиксатор поворота отопление") .AddKeyedScoped("Фиксатор поворота водоснабжение") .AddKeyedScoped("Трубка Г-образная") .AddKeyedScoped("Трубка Т-образная") .AddKeyedScoped("Резьбозажимное flex") .AddKeyedScoped("Резьбозажимное stabil") .AddKeyedScoped("Переходник на евроконус") .AddKeyedScoped("Резьбозажимное для трубки") .AddKeyedScoped("Ниппель") .AddKeyedScoped("Заглушка труб RAUTITAN") .AddKeyedScoped("Flex") .AddKeyedScoped("Pink") .AddKeyedScoped("Stabil") .AddKeyedScoped("Black"); var app = builder.Build(); app.MapControllers(); app.UseMiddleware(); var context = app.Services.CreateScope().ServiceProvider .GetRequiredService(); app.Run();