Exemple #1
0
        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();
            }

            return(connection);
        }
 public EntityFrameworkCoreBookStoreDbSchemaMigrator(BookStoreMigrationsDbContext dbContext)
 {
     _dbContext = dbContext;
 }