C# class library, Silverlight class library , asmx web services WTH

久未见 提交于 2019-12-11 07:57:50

问题


ASMX services do not have ability to reuse the Silverlight Class library and Silverlight application needs dedicated Class library and not the C# class library. So i had to duplicate the C# class library code to a Silverlight class library to work with my Silverlight application, now that was not the problem here. I would like technical answers(In depth if possible) to these questions

  • Why is it that Silverlight needs dedicated Silverlight Class library. Even though it runs above a layer on CLR

  • Methods on the ASMX service returns C# class library entities, why is this not castable to analogous silverlight class

  • How do i make the ASMX service work with same class library ( because the entities returned from webservice does not seem to display methods on them in the intellisense)


回答1:


OK here is the answer. Silverlight Class libraries are compatible with all .NET platforms (since they are stripped down version). Just do this compile the class library to assembly and then add reference (instead adding to the project).

  • Silverlight class library does additional references (to assemblies that target silverlight platform) behind the scenes hence silverlight also needs these references to work correctly

  • Create a instance of class again ( No simple way to do it)

  • Methods are actually meta data, they cannot be transported through wire in a webservice call. You can invoke the methods when objects are constructed again from data



来源:https://stackoverflow.com/questions/10477345/c-sharp-class-library-silverlight-class-library-asmx-web-services-wth

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