private static SqliteConnection CreateDatabaseAndGetConnection() { var connection = new SqliteConnection("Data Source=:memory:"); connection.Open(); var options = new DbContextOptionsBuilder <BookStoreMigrationsDbContext>() .UseSqlite(connection) .Options; using (var context = new BookStoreMigrationsDbContext(options)) { context.GetService <IRelationalDatabaseCreator>().CreateTables(); } var secondOptions = new DbContextOptionsBuilder <BookStoreSecondMigrationsDbContext>() .UseSqlite(connection) .Options; using (var context = new BookStoreSecondMigrationsDbContext(secondOptions)) { context.GetService <IRelationalDatabaseCreator>().CreateTables(); } return(connection); }
public EntityFrameworkCoreBookStoreDbSchemaMigrator(BookStoreMigrationsDbContext dbContext) { _dbContext = dbContext; }