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

前端 未结 5 1827
臣服心动
臣服心动 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条回答
  •  梦毁少年i
    2021-01-02 08:40

    The premise of this question is that WCF should map an XSD complexType element with an abstract attribute set to true as a C# abstract class. If you look at the WSDL spec on future extensibility, you'll see an example of how the spec uses this XSD feature to allow the addition of "element items" without needing to modify the WSDL spec itself.

    The purpose of the XSD abstract attribute is to allow other XSD "types" to inherit definitions from the base type. This may sound like what @dovholuk is looking for WCF to do, but in actually it is a device for XSD type definition. This XSD feature has no bearing on the serialization of XML into C# class constructs since it is intended to be use within XSD definitions. So summarizing both @blowdart & @JohnSaunders, WCF is an abstraction over message exchange of which XSD-based type definition is an implementation detail.

提交回复
热议问题