WHY doesn't WCF 'properly' consume/expose abstract types when hosted as a web service

前端 未结 5 1832
臣服心动
臣服心动 2021-01-02 08:23

I\'ve been designing web services for quite a while now but never had to expose a \'complicated\' WCF service until recently. I was baffled at the apparent lack of \"proper

5条回答
  •  無奈伤痛
    2021-01-02 08:59

    Well it's because WCF doesn't pass objects, it passes messages. This isn't remoting, so the type end up with on the client is not the same type you have on the server - it's simply a holding class for various properties. Implementing "abstract="true" simply makes no sense. Messages are just data - how would the client know what concrete type to use, as you're not sharing classes, but simply a representation of the message.

提交回复
热议问题