【问题标题】:PowerTools Beta 3 failsPowerTools Beta 3 失败
【发布时间】:2013-03-22 16:26:44
【问题描述】:

我试图生成“视图”以提高我的应用程序的性能。该应用程序是通过 RIA 服务链接到服务器的 Silverlight 4。服务器应用程序从 EF 4.1 + RIA 服务开始。 我安装了“EF Power Tools Beta 3 v0.7.0.0”并且可以毫无问题地生成我的视图。但我很快意识到 EF 4.1。无法从预编译的视图中受益。需要 EF >= 4.2。 通过 NuGet,我看到了使用 EF 5 的 RIA 服务 (RIAServices.EntityFramework.4.2.0) 的更新。我安装并让一切正常,但是当我尝试生成视图时出现异常:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

我已尝试重新安装 PowerTools。没运气 我已经下载了 PowerTools 的源代码并调试了异常。显然 PowerTools 正在尝试并且找不到旧的 EF 版本。 LoaderExceptions 属性读取:

{System.IO.FileNotFoundException: Could not load file or assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.

我调查了 PublicKeyToken 并确认它与我的“bin”输出映射中的 EF 5 (EF 4.4 target=.NET 4) dll 相同。但是 PowerTools 正在寻找 EF 4.1.. 为什么?

我的 web.config 文件有这个:

<sectionGroup name="system.serviceModel">
  <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" allowDefinition="MachineToApplication" requirePermission="false" />
</sectionGroup>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

和:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0" />
  </dependentAssembly>
</assemblyBinding>

我还测试了更改 Web.config 中的 PublicKeyToken 只是为了确认我从 PowerTools 收到另一个错误,因此 PowerTools 似乎解析了我的 Web.config。

【问题讨论】:

    标签: entity-framework ef-power-tools


    【解决方案1】:

    更新: 我创建了一个新的 Web 项目并将所有模型代码文件添加为链接。相同的连接字符串。现在我可以构建视图.. 奇怪.. 相同的引用。

    当我将视图添加到我的原始项目时,RIA 服务不会启动。删除了视图,它们又重新开始了。

    【讨论】:

      猜你喜欢
      • 2018-06-20
      • 1970-01-01
      • 1970-01-01
      • 2020-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-07
      相关资源
      最近更新 更多