using System.Data; using Npgsql; using ScrapperAPI.Interfaces; namespace ScrapperAPI.Factories; public sealed class NpgsqlConnectionFactory : IDbConnectionFactory { private readonly string _cs; public NpgsqlConnectionFactory(IConfiguration cfg) => _cs = cfg.GetConnectionString("Default")!; public async Task CreateOpenConnectionAsync(CancellationToken ct) { var conn = new NpgsqlConnection(_cs); await conn.OpenAsync(ct); return conn; } }