【发布时间】:2013-09-03 19:03:37
【问题描述】:
使用 WCF 和 DataContract 序列化程序,如何在查看 XSD 时将数据成员表示为 simpleType。例如:
[DataContract(Namespace="http://mydomain.xyz/example")]
public class MyType
{
[DataMember(IsRequired=true)]
public SomeBasicDataType basicAttribute { get; set; }
[DataMember(IsRequired=true)]
public SomeComplexType complexElement { get; set; }
}
基本上,我希望 someBasicDataType 在随附的 XSD 中为 <xs:simpleType name="SomeBasicDataType "> 而不是 <xs:complexType name="SomeBasicDataType">
【问题讨论】:
-
我相信你不能用 DataContract 做到这一点。可能 xml 序列化程序可以工作。
标签: c# wcf xsd datacontractserializer