我正在使用 FluentMigrator 来管理我的数据库更改,我像这样执行我的迁移:
const string connectionString = @"Data Source=localhost, 1433;Initial Catalog=testdb;Integrated Security=SSPI;";
Announcer announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
announcer.ShowSql = true;
Assembly assembly = Assembly.GetAssembly(typeof (MigrationMarker));
IRunnerContext migrationContext = new RunnerContext(announcer);
var options = new ProcessorOptions
{
PreviewOnly = false, // set to true to see the SQL
Timeout = 60
};
var factory = new SqlServer2008ProcessorFactory();
IMigrationProcessor processor = factory.Create(connectionString, announcer, options);
var runner = new MigrationRunner(assembly, migrationContext, processor);
runner.MigrateUp(true);
我不知道的是如何为特定配置文件执行迁移?
因此,鉴于我的迁移器具有这样的属性:
[Profile("DevMigration")]
public class DevMigration : FluentMigrator.Migration
{
我尝试了以下几种变体:
runner.ProfileLoader.FindProfilesIn(assembly, "DevMigrator");
runner.ApplyProfiles();
但我没有更进一步,有谁知道我如何使用跑步者执行配置文件迁移?