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


C# Migrator.UseCustomVersioning方法代码示例

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


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

示例1: TestIrreversibleMigrationExceptionIsThrown

        public void TestIrreversibleMigrationExceptionIsThrown()
        {
            long timestamp2 = typeof(Migration2).GetTimestamp();
            IVersioning versioning = GetVersioning(true, true, true);

            Migrator migrator = new Migrator("", ProviderNames.SqlServer2008);
            migrator.UseCustomVersioning(versioning);
            migrator.FetchMigrationsTo(typeof(Migration1).Assembly, timestamp2); // should throw an IrreversibleMigrationException as Migration3 is irreversible
        }
开发者ID:nachojammers,项目名称:MigSharp,代码行数:9,代码来源:MigratorTests.cs

示例2: VerifyPendingMigrationsAreFoundForSpecificModule

        public void VerifyPendingMigrationsAreFoundForSpecificModule()
        {
            IVersioning versioning = GetVersioning(false, false, false);

            Migrator migrator = new Migrator("", ProviderNames.SqlServer2008, new MigrationOptions { ModuleSelector = m => m == Migration2.Module });
            migrator.UseCustomVersioning(versioning);
            IMigrationBatch batch = migrator.FetchMigrations(typeof(Migration1).Assembly);

            Assert.AreEqual(1, batch.Count, string.Format(CultureInfo.CurrentCulture, "Only one migration for the module named '{0}' exists.", Migration2.Module));
        }
开发者ID:nachojammers,项目名称:MigSharp,代码行数:10,代码来源:MigratorTests.cs

示例3: VerifyPendingMigrationsAreFound

        public int VerifyPendingMigrationsAreFound(bool migration1IsContained, bool migration2IsContained, bool migration3IsContained)
        {
            IVersioning versioning = GetVersioning(migration1IsContained, migration2IsContained, migration3IsContained);

            Migrator migrator = new Migrator("", ProviderNames.SqlServer2008);
            migrator.UseCustomVersioning(versioning);
            IMigrationBatch batch = migrator.FetchMigrations(typeof(Migration1).Assembly);

            versioning.VerifyAllExpectations();
            return batch.Count;
        }
开发者ID:nachojammers,项目名称:MigSharp,代码行数:11,代码来源:MigratorTests.cs

示例4: MigratorUsesModuleSpecificTimestampProvider

        public void MigratorUsesModuleSpecificTimestampProvider()
        {
            var migrator = new Migrator("not-used", ProviderNames.SqlServer2005);
            var versioning = MockRepository.GenerateStub<IVersioning>();
            versioning.Expect(v => v.ExecutedMigrations).Return(Enumerable.Empty<IMigrationMetadata>()); // pretend, no migrations ran so far
            migrator.UseCustomVersioning(versioning);

            IMigrationBatch batch = migrator.FetchMigrations(_timestampModuleTestAssembly);

            Assert.AreEqual(4, batch.ScheduledMigrations.Count);

            IScheduledMigrationMetadata migration = batch.ScheduledMigrations.Single(m => m.ModuleName == MigrationExportAttribute.DefaultModuleName);
            Assert.AreEqual(1, migration.Timestamp);

            migration = batch.ScheduledMigrations.Single(m => m.ModuleName == "NonDefaultModuleTreatedWithDefaultTimestampProvider");
            Assert.AreEqual(23, migration.Timestamp);

            migration = batch.ScheduledMigrations.Single(m => m.ModuleName == "ModuleA");
            Assert.AreEqual(201110251455L, migration.Timestamp);

            migration = batch.ScheduledMigrations.Single(m => m.ModuleName == "ModuleB");
            Assert.AreEqual(201211171825L, migration.Timestamp);
        }
开发者ID:mediocreguy,项目名称:MigSharp,代码行数:23,代码来源:MigrationTimestampProviderTests.cs

示例5: MigratorUsesModuleSpecificTimestampProvider

        public void MigratorUsesModuleSpecificTimestampProvider()
        {
            var migrator = new Migrator("not-used", DbPlatform.SqlServer2005);
            var versioning = A.Fake<IVersioning>();
            A.CallTo(() => versioning.ExecutedMigrations).Returns(Enumerable.Empty<IMigrationMetadata>()); // pretend, no migrations ran so far
            migrator.UseCustomVersioning(versioning);

            IMigrationBatch batch = migrator.FetchMigrations(_timestampModuleTestAssembly);

            Assert.AreEqual(4, batch.Steps.Count);

            IMigrationStepMetadata step = batch.Steps.Single(m => m.ModuleName == MigrationExportAttribute.DefaultModuleName);
            Assert.AreEqual(1, step.Migrations.Single().Timestamp);

            step = batch.Steps.Single(m => m.ModuleName == "NonDefaultModuleTreatedWithDefaultTimestampProvider");
            Assert.AreEqual(23, step.Migrations.Single().Timestamp);

            step = batch.Steps.Single(m => m.ModuleName == "ModuleA");
            Assert.AreEqual(201110251455L, step.Migrations.Single().Timestamp);

            step = batch.Steps.Single(m => m.ModuleName == "ModuleB");
            Assert.AreEqual(201211171825L, step.Migrations.Single().Timestamp);
        }
开发者ID:dradovic,项目名称:MigSharp,代码行数:23,代码来源:MigrationTimestampProviderTests.cs


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