我试图生成“视图”来提高我的应用程序的性能。该应用程序是Silverlight 4与RIA服务链接到服务器。服务器应用程序以EF 4.1 + RIA Services开始。 我安装了“EF Power Tools Beta 3 v0.7.0.0”,可以毫无问题地生成我的视图。但我很快意识到EF 4.1。无法从预编译的视图中受益。 EF> = 4.2是必需的。 通过的NuGet我看到了它使用的EF 5.我安装并得到了一切工作,但RIA服务(RIAServices.EntityFramework.4.2.0)的更新,当我试图生成视图我得到一个异常:PowerTools Beta 3失败
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.
我已经研究了公钥,并证实它是一样的EF 5(EF 4.4目标= .NET 4)在我的“bin”输出映射发现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中的公钥刚确认我从PowerTools中得到了另一个错误,因此PowerTools似乎解析了我的Web.config。