Hello,
Does xsd.exe support generating .NET enumerations from XSD
enumerations?
That is, if I have
...
<xs:simpleType name="US_STATE">
<xs:restriction base="xs:string">
<xs:enumeration
value="AL"
/>
<xs:enumeration
value="AK"
/>
<xs:enumeration
value="AZ" />
...
</xs:restriction>
</xs:simpleType>
<xs:element name="State" type"US_STATE" >
...
as part of my schema, then as part of my generated dataset, I would like to
see something like the following (in C#):
public enum US_STATE
{
AL,
AK,
AZ,
...
}
...
public WhateverRow AddWhateverRow(
...
US_STATE STATE,
...
)
public US_STATE STATE
{
get
{
return ((US_STATE)
(this[this.tableWhatever.STATEColumn]));
}
set
{
this[this.tableWhatever.STATEColumn] = value;
}
}
The advantage would be to catch validation errors at compile time and the
ability to leverage IntelliSense (i.e. catching errors BEFORE compile time,
at programming-time :).
-Dan
PS: Similar questions apply to other xs:restrictions , such as
xs:maxLength , but I'm really most interested in xs:enumeration.