Beispiel #1
0
        public void InitializeDatabase(CONTEXT context)
        {
            var emptyContext = new DbContextWithoutTables(context.Database.Connection.ConnectionString);

            if (_alwaysRecreateTheDatabase && emptyContext.Database.Exists())
            {
                emptyContext.Database.Delete();
            }

            emptyContext.Database.CreateIfNotExists();

            var migrator = new Migrator(
                provider: new SqlCe4TransformationProvider(context.Database.Connection.ConnectionString),
                migrationAssembly: Migrator.DiscoverMigrationAssembly(),
                trace: true);

            migrator.MigrateToLastVersion();
        }
Beispiel #2
0
 protected void DiscoverMigrations(object sender, RoutedEventArgs e)
 {
     _migrationAssembly = Migrator.DiscoverMigrationAssembly();
 }