using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SewerStammGen.EntityFramework { public class SewerStammGenDbContextFactory : IDesignTimeDbContextFactory { private readonly Action _configureDbContext; public SewerStammGenDbContextFactory() { } public SewerStammGenDbContextFactory(Action configureDbContext) { _configureDbContext = configureDbContext; } public SewerStammGenDbContext CreateDbContext() { DbContextOptionsBuilder? options = new(); _configureDbContext( options ); return new SewerStammGenDbContext(options.Options); } public SewerStammGenDbContext CreateDbContext(string[] args) { var options = new DbContextOptionsBuilder(); options.UseNpgsql("Host = localhost; Database = SewerGen; Username = SewerGen; Password = SewerGen"); SewerStammGenDbContext result = new(options.Options); return result; } } }