【问题标题】:Entity Framework 6 RC 1 issue - Could not load type 'System.Data.Entity.Config.SingletonDependencyResolver`1'实体框架 6 RC 1 问题 - 无法加载类型“System.Data.Entity.Config.SingletonDependencyResolver`1”
【发布时间】:2013-08-26 12:04:07
【问题描述】:

自从升级到实体框架 6 rc 1 后,当我的 dbcontext 初始化时,我开始收到以下错误:

System.TypeLoadException:无法从程序集“EntityFramework,Version=6.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”加载类型“System.Data.Entity.Config.SingletonDependencyResolver`1”。

关于解决方案的任何想法?我找不到有关此的任何信息!

编辑

我回滚到 beta 1,问题消失了。潜在的 RC 1 错误...

【问题讨论】:

  • 您是否也更新了任何依赖包?就我而言,我更新了实体框架,但没有更新 sqlservercompact 包。 (正如 Pawel 指出的那样,一些命名空间已更改,因此依赖包损坏是有道理的。)

标签: c# entity-framework


【解决方案1】:

如果您有多个项目引用 EntityFramwork 和 EntityFramework.SqlServer,请确保更新每个项目。 PM> Install-Package EntityFramework -Pre 只更新默认项目。

【讨论】:

    【解决方案2】:

    在尝试使用以下方法将映射类添加到模型构建器时,更新到 RC1 后我也收到错误:

    modelBuilder.Configurations.AddFromAssembly(Assembly.GetExecutingAssembly());

    错误:

    {“找不到方法:'System.Data.Entity.ModelConfiguration.Configuration.PrimitivePropertyConfiguration1<System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration> System.Data.Entity.ModelConfiguration.Configuration.StructuralTypeConfiguration1.Property(System.Linq.Expressions.Expression1<System.Func2>)'。”}

    回滚到 beta 1 也解决了我的问题。似乎某些类型已移至不同的命名空间。

    【讨论】:

      【解决方案3】:

      SingletonDependencyResolver 已移至 System.Data.Entity.Infrastructure.DependencyResolution 命名空间。

      以下是 Beta1 和 RC 之间公共 API 的更改列表:

      https://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20July%2010%202013

      这是进行更改的变更集:

      https://entityframework.codeplex.com/SourceControl/changeset/eb3931b28fe64ae4531154fd7b0be3e2146eadd0

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-11
        • 1970-01-01
        • 2016-09-07
        • 1970-01-01
        相关资源
        最近更新 更多