using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Infrastructure.Data; using Infrastructure.Services.PostgreSQL; using Application.Contracts.Database; using Infrastructure.Services.MongoDB; namespace Infrastructure { public static class DependencyInjection { public static IServiceCollection AddInfrastructureServices(this IServiceCollection services, IConfiguration configuration) { services.AddDbContext(options => options.UseNpgsql(configuration.GetConnectionString("HealthcareManagerDatabase"))); services.AddScoped(); services.AddScoped(); services.AddScoped(); var mongoDbConnection = configuration.GetConnectionString("MongoDBDatabase"); services.AddSingleton(serviceProvider => new MongoDbService(mongoDbConnection)); // services.AddScoped(); return services; } } }