EF self tracking Silverlight WCf

北城余情 提交于 2019-12-11 16:42:39

问题


Hi I have a silverlight4 + .net 4.0 application where i am using self tracking entities. In the application i have a silverlight project which contains the entities generated by EF self tracking template. This project is being shared by the wcf service and the client so that the change tracking works. everything builds fine but when i run my service is get the exception Could not load file or assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.

any help is much appretiated

thanks Ben


回答1:


Correct version for Silverlight and probably also for STEs assmebly is:

// Assembly System.Runtime.Serialization, Version 2.0.5.0
Location: C:\Program Files (x86)\Microsoft Silverlight\4.0.60129.0\System.Runtime.Serialization.dll 
Name: System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e 
Type: Library 

If you have referenced v2.0.50727 you haven't loaded silverlight version but .NET 2.0 version which will have signiture like:

// Assembly System.Runtime.Serialization, Version 2.0.0.0
Location: C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Runtime.Serialization.dll 
Name: System.Runtime.Serialization, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Type: Library 



回答2:


Had to create a separate project with the entities which was mapped to client side . So 2 projects with contain the same entities. One is mapped to server and one mapped to client and each using different versions of Serialization dll



来源:https://stackoverflow.com/questions/5533124/ef-self-tracking-silverlight-wcf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!