I have a client supplied wsdl file containing an enum:
<xsd:simpleType name="OurEnum">
<xsd:annotation>
<xsd:appinfo>
<i:Base i:namespace="http://x.com/y/structures/2.0" i:name="Object"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="0"/>
<xsd:enumeration value="1"/>
<xsd:enumeration value="2"/>
<xsd:enumeration value="3"/>
<xsd:enumeration value="10"/>
</xsd:restriction>
Using Svcutil to create the WCF client, the code for enum looks like this:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.233")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://x.com/y/z/2.0")]
public enum OurEnum
{
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("0")]
Item0,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("1")]
Item1,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("10")]
Item10,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("2")]
Item2,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("3")]
Item3,
}
The creation of enum values as Item0, Item1, Item10 is very annoying. How should the Svcutil be used so that the generated code looks like:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.233")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://x.com/y/z/2.0")]
public enum OurEnum
{
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("0")]
0,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("1")]
1,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("10")]
10,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("2")]
2,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("3")]
3,
}
I have already tried using following serialization options for with Svcutil:
"/serializer:Auto" "/serializer:DataContractSerializer (failed badly)" "/serializer:XmlSerializer" "/importXmlTypes"
but the result remains the same.
I have also tried using Xsd.exe to create c-sharp code files from the xsds referred in the wsdl, but the result still remains the same.
Is there any other free tool out there, that can do the expected?
Any insight is greatly appreciated!