views:

110

answers:

1

I have a class property that is automatically generated by a framework with its appropriate XmlElement attribute. I inherit this class and expose it as a parameter on a webservice, for which a WSDL is auto-magically generated.

I need to replace said property's XmlElement attribute with my own, and have the WSDL generate using my new attribute. How can i do this outside the framework generated code? ie: in either the inherited class, or partial class structure?

A: 

You'll have to inherit from the other class, and implement IXmlSerializable.

The good news is that you should be able to get the XML Serializer to do all or most of the work for you. In the ReadXml method you'll call Deserialize, in the WriteXml method you'll call Serialize. You'll use the XmlAttributeOverrides class to specify the different element name.

I'm not 100% certain this will be adequate to get the auto-generated WSDL to change.

John Saunders