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