谁能告诉我,为什么 xsd 中的整数元素在字符串字段中转换?
<xs:element name="OwnerID" type="xs:integer"/>
进入
[System.Xml.Serialization.XmlElementAttribute(DataType = "integer")]
public string OwnerID
{
get
{
return this.ownerIDField;
}
set
{
this.ownerIDField = value;
}
}
我的第一个假设是所有字段都是由真实数据类型归因的字符串,这是不正确的 - 日期被解释为日期, bool 值被解释为 bool 值 - 整数有什么问题?
提前致谢!
最佳答案
你需要这样的东西:
<xs:element name="OwnerID" >
<xs:simpleType>
<xs:restriction base="xs:int" />
</xs:simpleType>
</xs:element>
关于c# - Visual Studio : generating code upon xsd problems with integers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7991307/