using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace Deal.Infrastructure.Persistence;
///
/// Фабрика для dotnet-ef
///
public sealed class DealDbDesignTimeFactory : IDesignTimeDbContextFactory
{
public DealDbContext CreateDbContext(string[] args)
{
string connectionString = Environment.GetEnvironmentVariable("DEAL_PG_CONNECTION")
?? "Host=localhost;Port=5433;Database=deal;Username=deal;Password=deal_dev_password";
var options = new DbContextOptionsBuilder()
.UseNpgsql(connectionString)
.Options;
return new DealDbContext(options);
}
}