我使用的是FuentMigrator和FluentMigrator.Runner 3.1.3
我的迁移运行良好,并且是针对数据库执行的。但是,当我尝试执行嵌入式资源sql时,我得到了以下错误消息:
无法激活类型'FluentMigrator.Infrastructure.DefaultEmbeddedResourceProvider'.以下构造函数不明确: Void .ctor(System.Collections.Generic.IEnumerable`1System.Reflection.Assembly) Void .ctor(FluentMigrator.Infrastructure.IAssemblyCollection)
IAssemblyCollection的构造函数在文档中被标记为已过时,但仍被视为可能的构造函数。
我没有找到有关此问题的任何信息,并在以前版本的FluentMigrator中使用过此功能
我在欣赏中的代码
public override void Up()
{
Execute.EmbeddedScript("M201810311049CreateInvoiceOverview_up.sql");
}runner的代码
string connectionString = ConfigurationManager.ConnectionStrings["WorkingWithData"].ConnectionString;
Announcer announcer = new TextWriterAnnouncer(s => System.Diagnostics.Debug.WriteLine(s));
announcer.ShowSql = true;
Assembly assembly = Assembly.GetExecutingAssembly();
IRunnerContext migrationContext = new RunnerContext(announcer);
var options = new ProcessorOptions
{
PreviewOnly = false, // set to true to see the SQL
Timeout = TimeSpan.FromSeconds(60)
};
var factory = new SqlServer2014ProcessorFactory();
using (IMigrationProcessor processor = factory.Create(connectionString, announcer, options))
{
var runner = new MigrationRunner(assembly, migrationContext, processor);
runner.MigrateUp(true);
// Or go back down
//runner.MigrateDown(0);
}发布于 2019-04-29 21:11:31
这是FluentMigrator版本中的一个错误。在旧版本中可以完美地工作。
https://stackoverflow.com/questions/53091898
复制相似问题