Ejemplo n.º 1
0
        private void MigrateTo(long targetVersion)
        {
            var options = new MigrationOptions { PreviewOnly = false,  Timeout = 60 };
            var announcer = new NullAnnouncer();
            var processor = new SqlServer2012ProcessorFactory().Create(connectionString, announcer, options);
            var migrationContext = new RunnerContext(announcer) { Namespace = "DDDEastAnglia.DatabaseMigrations.Migrations" };

            var runner = new MigrationRunner(GetType().Assembly, migrationContext, processor);
            runner.MigrateUp(targetVersion, true);
        }
Ejemplo n.º 2
0
        public void MigrateToLatest()
        {
            var asm = Assembly.GetExecutingAssembly();
            var announcer = new TextWriterAnnouncer((str) =>
            {
                Debug.WriteLine(str);
            });
            var context = new RunnerContext(announcer);
            var options = new MigrationOptions();
            var factory = new SqlServer2012ProcessorFactory();
            var processor = factory.Create(this._connectionString, announcer, options);
            var runner = new MigrationRunner(asm, context, processor);

            runner.MigrateUp(true);
        }
Ejemplo n.º 3
0
        private IMigrationProcessor CreateMigrationProcessor(Announcer announcer)
        {
            var options = new ProcessorOptions
            {
                PreviewOnly = false, // set to true to see the SQL
                Timeout = 60,
            };

            EnsureConnectionAvailable(_connectionString);

            var factory = new SqlServer2012ProcessorFactory();
            IMigrationProcessor processor = factory.Create(_connectionString, announcer, options);
            return processor;
        }