コード例 #1
0
        private static SqliteConnection CreateDatabaseAndGetConnection()
        {
            var connection = new SqliteConnection("Data Source=:memory:");

            connection.Open();

            var options = new DbContextOptionsBuilder <DatacenterMigrationsDbContext>()
                          .UseSqlite(connection)
                          .Options;

            using (var context = new DatacenterMigrationsDbContext(options))
            {
                context.GetService <IRelationalDatabaseCreator>().CreateTables();
            }

            return(connection);
        }
コード例 #2
0
 public EntityFrameworkCoreDatacenterDbSchemaMigrator(DatacenterMigrationsDbContext dbContext)
 {
     _dbContext = dbContext;
 }