简体   繁体   中英

Invisible class from WebService in application

I've got webservice which has multiple classess

My winforms application see theirs, but not everyone.

This application has webreference to this webservice.

I think that this application see every class which is used in WebMethod, but I using parent class in WebMethod and I wanna casting it to another class,which is not used at webmethod.

In the referencing application you don't "see" any of the classes of the webservice. There is a proxy-class generated for all classes used in webmethods. So in your client application you are not using the parent class, but a proxy of the parent class.

Try to:

  1. Put all data classes in a separate assembly, which you reference from the webservice and from the client.
  2. Build a method that (or get a solution that) copies every property of the proxy-class to the original.
  3. Then cast the original to the derived class.

There are existing solutions that copy proxies to the original-classes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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