我試圖生成「視圖」來提高我的應用程序的性能。該應用程序是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。