using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Persistence.Database.Model; public static class DependencyInjection { public static IServiceCollection AddPersistenceDbContext(this IServiceCollection services, IConfiguration configuration) { string connectionStringName = "DefaultConnection"; services.AddDbContext(options => options.UseNpgsql(configuration.GetConnectionString(connectionStringName))); services.AddScoped(provider => provider.GetRequiredService()); return services; } }