简体   繁体   English

C#类库,Silverlight类库,ASTM Web服务WTH

[英]C# class library, Silverlight class library , asmx web services WTH

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. ASMX服务无法重用Silverlight类库,Silverlight应用程序需要专用的类库而不是C#类库。 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. 因此,我不得不将C#类库代码复制到Silverlight类库中才能与我的Silverlight应用程序一起使用,现在这不是问题所在。 I would like technical answers(In depth if possible) to these questions 我想要这些问题的技术答案(如果可能的话,请深入)

  • Why is it that Silverlight needs dedicated Silverlight Class library. 为什么Silverlight需要专用的Silverlight类库。 Even though it runs above a layer on CLR 即使它在CLR的某一层之上运行

  • Methods on the ASMX service returns C# class library entities, why is this not castable to analogous silverlight class 在ASMX服务方法返回C#类库的实体,这是为什么不castable ,以类似的Silverlight类

  • 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) 我如何使ASMX服务与相同的类库一起工作(因为从webservice返回的实体似乎在智能感知中未显示方法)

OK here is the answer. 好的,这就是答案。 Silverlight Class libraries are compatible with all .NET platforms (since they are stripped down version). Silverlight类库与所有.NET平台兼容(因为它们是精简版)。 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 Silverlight类库在幕后进行了其他引用(针对以Silverlight平台为目标的程序集),因此Silverlight也需要这些引用才能正常工作

  • 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. 方法实际上是元数据,无法在Webservice调用中通过电线进行传输。 You can invoke the methods when objects are constructed again from data 从数据再次构造对象时,可以调用方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM