【发布时间】:2013-06-14 00:24:16
【问题描述】:
我正在使用 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();
但我还没有走近,有人知道我如何使用运行器执行配置文件迁移吗?
【问题讨论】:
标签: c# fluent-migrator