private static IServiceProvider CreateServices() { var dbParams = PostgresConnectionParams.FromEnv(); return(new ServiceCollection() .AddFluentMigratorCore() .ConfigureRunner(rb => rb .AddPostgres() .WithGlobalConnectionString(dbParams.GetConnectionString()) .ScanIn(typeof(Program).Assembly).For.Migrations()) .AddLogging(lb => lb.AddFluentMigratorConsole()) .BuildServiceProvider(false)); }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { var dbParams = PostgresConnectionParams.FromEnv(); optionsBuilder.UseNpgsql(dbParams.GetConnectionString()); }