WCF generated XSD and ExtensionDataObject

This line gets generated for all of my xsd objects, where is this coming from and how do I remove it from being generated in the XSD file.

<xs:element minOccurs="0" maxOccurs="1" name="ExtensionData" type="tns:ExtensionDataObject" />




Answer this question

WCF generated XSD and ExtensionDataObject

  • rain0x01

    The schema comes from a XSD designed with MSVS 2005, and then added to the project and used as request parameters, and response parameters in the WCF Operation Contract.

            [OperationContract(Name = "Test")]
            ResponseTest Test(TestReq req);

    ResponseTest and TestReq are both from the xsd in the project. So are you saying I can't use the xsd, I have to build DataContract classes for everything that is in the XSD.  I hope there is a way to connect the DataContract to the XSD in the project without having to rewrite a bunch of classes that reflect what is in the XSD.



  • Webdav101

    How are you getting the schema There are several different serialization programming models - e.g. the XmlSerializer model (that existed since .NET 1.0) and the new DataContract programming model (introduced in WCF). In general, if you run a tool designed for one programming model on classes that are designed with another programming model, you will get unexpected results. The correct way to get schema from Data Contract classes is to use the svcutil.exe tool (you can use the "/dconly" switch to only generate schema). If you do that, you will not get the extra "ExtensionData" element. However, if you use the old "xsd.exe" tool (that was never designed for the new Data Contract programming model) you will get schema that may be incorrect in many ways, including this extra "ExtensionData" element.

  • WCF generated XSD and ExtensionDataObject