【问题标题】:How to avoid svcutil to produce XmlSerializerFormatAttribute for collection type?如何避免 svcutil 为集合类型生成 XmlSerializerFormatAttribute?
【发布时间】:2013-04-20 19:38:14
【问题描述】:

使用 svcutil 从 WSDL 生成 C# 代码;

我想避免 XmlSerializerFormatAttribute 属性;我知道它为什么会产生,不知道如何正确使用它来避免它?让我们做一些研究;基本上低于生产它的xsd;有什么想法吗?

 <xs:complexType name="CNT_Country">
        <xs:annotation>
            <xs:documentation/>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="CountryId" type="xs:string"/>
            <xs:element name="CountryName" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="CNT_CountryLst_Type">
        <xs:annotation>
            <xs:documentation>This is List of Country</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" minOccurs="0" nillable="true" name="CountryList" type="CNT_Country"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element> 

【问题讨论】:

    标签: c# wcf xsd wsdl svcutil.exe


    【解决方案1】:

    猜测:你的列表是 IList 类型的吗?

    在这种情况下,这篇文章可能会有所帮助:

    WCF: Serializing and Deserializing generic collections

    简而言之,它描述了 IList 反序列化中的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-11
      • 2015-04-20
      • 1970-01-01
      • 2021-11-14
      • 1970-01-01
      • 1970-01-01
      • 2013-12-24
      相关资源
      最近更新 更多