首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法激活类型'FluentMigrator.Infrastructure.DefaultEmbeddedResourceProvider

无法激活类型'FluentMigrator.Infrastructure.DefaultEmbeddedResourceProvider
EN

Stack Overflow用户
提问于 2018-11-01 05:00:37
回答 1查看 262关注 0票数 3

我使用的是FuentMigratorFluentMigrator.Runner 3.1.3

我的迁移运行良好,并且是针对数据库执行的。但是,当我尝试执行嵌入式资源sql时,我得到了以下错误消息:

无法激活类型'FluentMigrator.Infrastructure.DefaultEmbeddedResourceProvider'.以下构造函数不明确: Void .ctor(System.Collections.Generic.IEnumerable`1System.Reflection.Assembly) Void .ctor(FluentMigrator.Infrastructure.IAssemblyCollection)

IAssemblyCollection的构造函数在文档中被标记为已过时,但仍被视为可能的构造函数。

我没有找到有关此问题的任何信息,并在以前版本的FluentMigrator中使用过此功能

我在欣赏中的代码

代码语言:javascript
复制
public override void Up()
    {
        Execute.EmbeddedScript("M201810311049CreateInvoiceOverview_up.sql");
    }

runner的代码

代码语言:javascript
复制
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);
        }
EN

回答 1

Stack Overflow用户

发布于 2019-04-29 21:11:31

这是FluentMigrator版本中的一个错误。在旧版本中可以完美地工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53091898

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档