![](/img/trans.png)
[英]Unable to resolve service for type xxx.'Infrastructure' while attempting to activate 'xxx.Infrastructure.TagRepository'
[英]Unable to activate type 'FluentMigrator.Infrastructure.DefaultEmbeddedResourceProvider
我正在使用FuentMigrator
和FluentMigrator.Runner
3.1.3
我的遷移工作正常,並且已對數據庫執行。 但是,當我嘗試執行嵌入式資源sql時,出現以下錯誤消息:
無法激活類型“ FluentMigrator.Infrastructure.DefaultEmbeddedResourceProvider”。 以下構造函數是模棱兩可的:Void .ctor(System.Collections.Generic.IEnumerable`1 [System.Reflection.Assembly])Void .ctor(FluentMigrator.Infrastructure.IAssemblyCollection)
IAssemblyCollection
的構造函數在IAssemblyCollection
被標記為已過時,但仍視為可能的構造函數。
我沒有找到有關此問題的任何信息,並且在以前的FluentMigrator
版本中使用了此功能
我的代碼在遷移中
public override void Up()
{
Execute.EmbeddedScript("M201810311049CreateInvoiceOverview_up.sql");
}
跑步者代碼
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);
}
這是FluentMigrator版本的錯誤。 在舊版本中完美運行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.