当前位置: 首页>>代码示例>>C#>>正文


C# Migrator.MigrateTo方法代码示例

本文整理汇总了C#中Migrator.MigrateTo方法的典型用法代码示例。如果您正苦于以下问题:C# Migrator.MigrateTo方法的具体用法?C# Migrator.MigrateTo怎么用?C# Migrator.MigrateTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Migrator的用法示例。


在下文中一共展示了Migrator.MigrateTo方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUp

		public void SetUp()
		{			
            _migrator = new Migrator(TransformationProvider, MigrationAssembly, true);
			
			Assert.IsTrue(_migrator.MigrationsTypes.Count > 0, "No migrations in assembly " + MigrationAssembly.Location);
			
			_migrator.MigrateTo(0);
		}
开发者ID:jango2015,项目名称:Migrator.NET,代码行数:8,代码来源:MigrationTestCase.cs

示例2: SetUp

        public void SetUp()
        {
            _migrator = new Migrator(TransformationProvider);

            Assert.IsTrue(_migrator.MigrationsTypes.Count > 0);

            _migrator.MigrateTo(0);
        }
开发者ID:kayone,项目名称:Migrator.NET,代码行数:8,代码来源:MigrationTestCase.cs

示例3: MigratorThrowsErrorIfDuplicateTimestampProvidersFoundForModule

 public void MigratorThrowsErrorIfDuplicateTimestampProvidersFoundForModule()
 {
     var migrator = new Migrator("not-used", ProviderNames.SQLite, new MigrationOptions("TimestampProviderDuplicateTest"));
     migrator.MigrateTo(_duplicateProviderTestAssembly, 1);
 }
开发者ID:mediocreguy,项目名称:MigSharp,代码行数:5,代码来源:MigrationTimestampProviderTests.cs

示例4: TestUndoingMigration2

        public void TestUndoingMigration2()
        {
            var migrator = new Migrator(ConnectionString, ProviderName, _options);
            Assembly assemblyContainingMigrations = typeof(Migration1).Assembly;
            migrator.MigrateTo(assemblyContainingMigrations, Timestamps[1]);

            migrator = new Migrator(ConnectionString, ProviderName);
            migrator.MigrateTo(assemblyContainingMigrations, Timestamps[0]);

            // assert order table was dropped
            DataTable orderTable = GetTable(new Migration2().Tables[0].Name);
            Assert.IsNull(orderTable, "The order table was not dropped.");

            // assert Versioning table has only necessary entries
            DataTable versioningTable = GetTable(_options.VersioningTableName);
            Assert.AreEqual(1, versioningTable.Rows.Count, "The versioning table is missing entries or has too much entries.");
            Assert.AreEqual(Timestamps[0], versioningTable.Rows[0][0], "The timestamp of Migration1 is wrong.");
            Assert.AreEqual(MigrationExportAttribute.DefaultModuleName, versioningTable.Rows[0][1], "The module of Migration1 is wrong.");
            Assert.AreEqual(DBNull.Value, versioningTable.Rows[0][2], "The tag of Migration1 is wrong.");
        }
开发者ID:nachojammers,项目名称:MigSharp,代码行数:20,代码来源:IntegrationTestsBase.cs

示例5: TestScriptingAndExecutingMigration1

        public void TestScriptingAndExecutingMigration1()
        {
            DirectoryInfo targetDirectory = PrepareScriptingDirectory();
            _options.VersioningTableName = "My Versioning Table"; // test overriding the default versioning table name
            _options.ExecuteAndScriptSqlTo(targetDirectory);
            var migrator = new Migrator(ConnectionString, ProviderName, _options);
            migrator.MigrateTo(typeof(Migration1).Assembly, Timestamps[0]);

            CheckResultsOfMigration1();

            // assert that the script file was generated
            FileInfo[] scriptFiles = targetDirectory.GetFiles(string.Format(CultureInfo.InvariantCulture, "Migration." + MigrationExportAttribute.DefaultModuleName + ".1.sql"));
            Assert.AreEqual(1, scriptFiles.Length);

            // delete script files
            targetDirectory.Delete(true);
        }
开发者ID:nachojammers,项目名称:MigSharp,代码行数:17,代码来源:IntegrationTestsBase.cs

示例6: TestMigration1SucceededByAllOtherMigrations

        public void TestMigration1SucceededByAllOtherMigrations()
        {
            // execute Migration1
            var migrator = new Migrator(ConnectionString, ProviderName, _options);
            Assembly assemblyContainingMigrations = typeof(Migration1).Assembly;
            migrator.MigrateTo(assemblyContainingMigrations, Timestamps[0]);

            // execute all other migrations
            migrator = new Migrator(ConnectionString, ProviderName, _options);
            migrator.MigrateAll(assemblyContainingMigrations);
            Assert.IsTrue(migrator.IsUpToDate(assemblyContainingMigrations));

            VerifyResultsOfAllMigrations();
        }
开发者ID:nachojammers,项目名称:MigSharp,代码行数:14,代码来源:IntegrationTestsBase.cs

示例7: TestMigration1

        public void TestMigration1()
        {
            _options.VersioningTableName = "My Versioning Table"; // test overriding the default versioning table name
            var migrator = new Migrator(ConnectionString, ProviderName, _options);
            migrator.MigrateTo(typeof(Migration1).Assembly, Timestamps[0]);

            CheckResultsOfMigration1();
        }
开发者ID:nachojammers,项目名称:MigSharp,代码行数:8,代码来源:IntegrationTestsBase.cs

示例8: RunMigration

		void RunMigration(Migrator mig)
		{
			if (mig.DryRun)
				mig.Logger.Log("********** Dry run! Not actually applying changes. **********");

			if (_to == -1)
				mig.MigrateToLastVersion();
			else
				mig.MigrateTo(_to);
		}
开发者ID:modulexcite,项目名称:Migrator.NET,代码行数:10,代码来源:MigrateTask.cs

示例9: TestUndoingMigration2

        public void TestUndoingMigration2()
        {
            var migrator = new Migrator(ConnectionString, ProviderName, _options);
            Assembly assemblyContainingMigrations = typeof(Migration1).Assembly;
            migrator.MigrateTo(assemblyContainingMigrations, Timestamps[1]);

            migrator = new Migrator(ConnectionString, ProviderName);

            // verify if the migrations batch is populated correctly
            IMigrationBatch batch = migrator.FetchMigrationsTo(assemblyContainingMigrations, Timestamps[0]);
            Assert.AreEqual(1, batch.ScheduledMigrations.Count, "Only the reversal of Migration2 should be scheduled.");
            Assert.AreEqual(Timestamps[1], batch.ScheduledMigrations[0].Timestamp);
            Assert.AreEqual(Migration2.Module, batch.ScheduledMigrations[0].ModuleName);
            Assert.AreEqual(Migration2.Tag, batch.ScheduledMigrations[0].Tag);
            Assert.AreEqual(MigrationDirection.Down, batch.ScheduledMigrations[0].Direction);

            // use MigrateTo to execute the actual migrations to test that method, too
            migrator.MigrateTo(assemblyContainingMigrations, Timestamps[0]);

            // assert order table was dropped
            DataTable orderTable = GetTable(new Migration2().Tables[0].Name);
            Assert.IsNull(orderTable, "The order table was not dropped.");

            // assert Versioning table has only necessary entries
            DataTable versioningTable = GetTable(_options.VersioningTableName);
            Assert.AreEqual(1, versioningTable.Rows.Count, "The versioning table is missing entries or has too much entries.");
            Assert.AreEqual(Timestamps[0], versioningTable.Rows[0][0], "The timestamp of Migration1 is wrong.");
            Assert.AreEqual(MigrationExportAttribute.DefaultModuleName, versioningTable.Rows[0][1], "The module of Migration1 is wrong.");
            Assert.AreEqual(DBNull.Value, versioningTable.Rows[0][2], "The tag of Migration1 is wrong.");
        }
开发者ID:halad,项目名称:MigSharp,代码行数:30,代码来源:IntegrationTestsBase.cs

示例10: TestMigration1SucceededByAllOtherMigrations

        public void TestMigration1SucceededByAllOtherMigrations()
        {
            // execute Migration1
            var migrator = new Migrator(ConnectionString, ProviderName, _options);
            Assembly assemblyContainingMigrations = typeof(Migration1).Assembly;
            migrator.MigrateTo(assemblyContainingMigrations, Timestamps[0]);

            // execute all other migrations
            migrator = new Migrator(ConnectionString, ProviderName, _options);
            migrator.MigrateAll(assemblyContainingMigrations);

            // make sure there are no more migrations to run
            IMigrationBatch batch = migrator.FetchMigrations(assemblyContainingMigrations);
            Assert.AreEqual(0, batch.ScheduledMigrations.Count);

            VerifyResultsOfAllMigrations();
        }
开发者ID:halad,项目名称:MigSharp,代码行数:17,代码来源:IntegrationTestsBase.cs

示例11: TestMigration1

        public void TestMigration1()
        {
            _options.VersioningTableName = "My Versioning Table"; // test overriding the default versioning table name
            var migrator = new Migrator(ConnectionString, ProviderName, _options);

            // verify if the migrations batch is populated correctly
            IMigrationBatch batch = migrator.FetchMigrationsTo(typeof(Migration1).Assembly, Timestamps[0]);
            Assert.AreEqual(1, batch.ScheduledMigrations.Count);
            Assert.AreEqual(Timestamps[0], batch.ScheduledMigrations[0].Timestamp);
            Assert.AreEqual(MigrationExportAttribute.DefaultModuleName, batch.ScheduledMigrations[0].ModuleName);
            Assert.IsNull(batch.ScheduledMigrations[0].Tag);
            Assert.AreEqual(MigrationDirection.Up, batch.ScheduledMigrations[0].Direction);

            // use MigrateTo to execute the actual migrations to test that method, too
            migrator.MigrateTo(typeof(Migration1).Assembly, Timestamps[0]);

            CheckResultsOfMigration1();
        }
开发者ID:halad,项目名称:MigSharp,代码行数:18,代码来源:IntegrationTestsBase.cs

示例12: MigrateDown

 public void MigrateDown()
 {
     var migrator = new Migrator(_config.ConnectionString, ProviderNames.SqlServer2008, _options);
     migrator.MigrateTo(typeof(V001_Initial_1).Assembly, 0);
 }
开发者ID:pedershk,项目名称:dotnetprograms,代码行数:5,代码来源:VisualFarmMigrator.cs

示例13: RunMigration

 public void RunMigration(Migrator.Migrator mig)
 {
     if (mig.DryRun)
     {
         mig.Logger.Log("********** Dry run! Not actually applying changes. **********", new object[0]);
     }
     if (this.To == -1L)
     {
         mig.MigrateToLastVersion();
     }
     else
     {
         mig.MigrateTo(this.To);
     }
 }
开发者ID:rnarayana,项目名称:PowerUp,代码行数:15,代码来源:DatabaseMigrator.cs

示例14: MigratorUsesModuleSpecificTimestampProvider

        public void MigratorUsesModuleSpecificTimestampProvider()
        {
            var errorThrown = false;
            var migrator = new Migrator("not-used", ProviderNames.SQLite, new MigrationOptions("TimestampProviderTest"));
            try
            {
                migrator.MigrateTo(_timestampModuleTestAssembly, 1);
            }
            catch (NotImplementedException ex)
            {
                Assert.AreEqual("TimestampProviderTest called", ex.Message);
                errorThrown = true;
            }

            Assert.IsTrue(errorThrown, "Timestamp Provider not called");
        }
开发者ID:richardprior,项目名称:MigSharp,代码行数:16,代码来源:MigrationTimestampProviderTests.cs


注:本文中的Migrator.MigrateTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。