本文整理汇总了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
}
示例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));
}
示例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;
}
示例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);
}
示例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);
}