Beispiel #1
0
        public BookStoreMigrationsDbContext CreateDbContext(string[] args)
        {
            BookStoreEfCoreEntityExtensionMappings.Configure();

            var configuration = BuildConfiguration();

            var builder = new DbContextOptionsBuilder <BookStoreMigrationsDbContext>()
                          .UseMySql(configuration.GetConnectionString("Default"));

            return(new BookStoreMigrationsDbContext(builder.Options));
        }
        public BookStoreMigrationsDbContext CreateDbContext(string[] args)
        {
            BookStoreEfCoreEntityExtensionMappings.Configure();

            var configuration = BuildConfiguration();

            //var builder = new DbContextOptionsBuilder<BookStoreMigrationsDbContext>()
            //    .UseSqlServer(configuration.GetConnectionString("Default"));

            //var builder = new DbContextOptionsBuilder<PostgeSqlDemoMigrationsDbContext>()
            //   .UseNpgsql(configuration.GetConnectionString("Default"), opts => opts.UseNetTopologySuite());

            var builder = new DbContextOptionsBuilder <BookStoreMigrationsDbContext>()
                          .UseNpgsql(configuration.GetConnectionString("Default"));

            return(new BookStoreMigrationsDbContext(builder.Options));
        }
 public override void PreConfigureServices(ServiceConfigurationContext context)
 {
     BookStoreEfCoreEntityExtensionMappings.Configure();
 }