WCF: collection proxy type on client

Posted by Unholy on Stack Overflow See other posts from Stack Overflow or by Unholy
Published on 2010-03-04T05:29:45Z Indexed on 2010/03/09 4:51 UTC
Read the original article Hit count: 207

Filed under:

I have the following type in wsdl (it is generated by third party tool):

<xsd:complexType name="IntArray">
  <xsd:sequence>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="Elements" type="xsd:int" /> 
  </xsd:sequence>
</xsd:complexType>

Sometimes Visual Studio generates:

public class IntArray : System.Collections.Generic.List<int> {}

And sometimes it doesn't generate any proxy type for this wsdl and just uses int[].

Collection type in Web Service configuration is System.Array.

What could be the reason for such upredictable behavior?

Edited:

I found the way how I can reproduce this behavior.

For examle we have two types:

<xsd:complexType name="IntArray">
  <xsd:sequence>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="Elements" type="xsd:int" /> 
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="StringArray">
  <xsd:sequence>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="Elements" type="xsd:string" /> 
  </xsd:sequence>
</xsd:complexType>

VS generates:

public class IntArray : System.Collections.Generic.List<int> {}

public class StringArray : System.Collections.Generic.List<string> {}

Now I change StringArray type:

<xsd:complexType name="StringArray">
  <xsd:sequence>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="Elements" type="xsd:string" /> 
    <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax" />
  </xsd:sequence>
  <xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:complexType>

VS generates proxy type for StringArray only. But not for IntArray.

© Stack Overflow or respective owner

Related posts about wcf