migrator.net

migratordotnet - Run migrations from within application (w/o nant or build)

匆匆过客 提交于 2019-12-03 16:38:52
问题 is there a way to run migrations from within the application itself? Thanks! 回答1: I instantiate an instance of the Migrator class, and then you can call member methods like MigrateToLastVersion() or MigrateTo(long versionnr) Migrator.Migrator m = new Migrator.Migrator ("SqlServer", connectionString, migrationsAssembly) m.MigrateToLastVersion(); 回答2: I don't see why not. Have a look at the nant task http://code.google.com/p/migratordotnet/source/browse/trunk/src/Migrator.NAnt/MigrateTask.cs

migratordotnet - Run migrations from within application (w/o nant or build)

為{幸葍}努か 提交于 2019-12-03 05:54:24
is there a way to run migrations from within the application itself? Thanks! I instantiate an instance of the Migrator class, and then you can call member methods like MigrateToLastVersion() or MigrateTo(long versionnr) Migrator.Migrator m = new Migrator.Migrator ("SqlServer", connectionString, migrationsAssembly) m.MigrateToLastVersion(); I don't see why not. Have a look at the nant task http://code.google.com/p/migratordotnet/source/browse/trunk/src/Migrator.NAnt/MigrateTask.cs Relevant bits are here: private void Execute(Assembly asm) { Migrator mig = new Migrator(Provider, ConnectionString