Exemplo n.º 1
0
        private static async Task ResetDb(IHostingEnvironment env)
        {
            using (var dbInitializer = new DatabaseInitializer(DatabaseConnectionStringProvider.GetConnectionString()))
            {
                Console.WriteLine("Dropping database objects");
                dbInitializer.DropDatabase();
                Console.WriteLine("Creating database objects");
                dbInitializer.InitializeDatabase();
                await Seed(env);

                Console.WriteLine("Database ready");
            }
        }
 public TestDatabaseInitializer(IContainer container)
 {
     using (var dbInitializer = new DatabaseInitializer(DatabaseConnectionStringProvider.GetConnectionString()))
     {
         Console.WriteLine("Dropping database objects");
         dbInitializer.DropDatabase();
         Console.WriteLine("Creating database objects");
         dbInitializer.InitializeDatabase();
         Console.WriteLine();
         Task.Run(async() => await Testseed.Execute(container)).Wait();
         Console.WriteLine("Database ready");
     }
 }