示例#1
0
        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));
        }
示例#2
0
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            var dbParams = PostgresConnectionParams.FromEnv();

            optionsBuilder.UseNpgsql(dbParams.GetConnectionString());
        }