I use a free migrator to manage my migrations in the database, but what I would like to do is the migration that starts when the application starts. The closest I managed:
public static void MigrateToLatest(string connectionString) { using (var announcer = new TextWriterAnnouncer(Console.Out) { ShowElapsedTime = true, ShowSql = true }) { var assembly = typeof(Runner).Assembly.GetName().Name; var migrationContext = new RunnerContext(announcer) { Connection = connectionString, Database = "SqlServer2008", Target = assembly }; var executor = new TaskExecutor(migrationContext); executor.Execute(); } }
I am sure that this worked for me, but I have never considered it (a hobby project), and now it throws null reference exceptions when it gets into the Execute line. Unfortunately, there are no documents for this, and for a long time I hit my head about it.
Has anyone been able to get this kind of work with FluentMigrator?
ilivewithian Sep 27 '11 at 19:07 2011-09-27 19:07
source share