Web Service Factory: Creating a schema for a System.Collections.Generic.List<customer>

  • Thread starter Henrik Skak Pedersen
  • Start date
H

Henrik Skak Pedersen

Hi,

I have created a xsd file with a element called Customer. When I then select
"Create data types from schema" a customer class is being generated. But how
do I handle a list of customers? In code I would of course like to use a
generic list, but how does that fit into the factory?

Is it a problem that the List not is a part of the schema?

I guess that I can't use it in the factory wizards?

Thanks
Henrik.
 
S

Steven Cheng[MSFT]

Hello Henrik,

As for the "Create data types from schema", are you using the xsd.exe
utility or any other component to generate the class from XSD schema?

For Genericic List<xxx> type of any other Array/List based types, .net
webservice or XML seriailation will use the following like XML Array
element to map them(the "ArrayOfCustomer" element):

================
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="ArrayOfCustomer" nillable="true" type="ArrayOfCustomer"
/>
<xs:complexType name="ArrayOfCustomer">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Customer"
nillable="true" type="Customer" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="Customer">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="FirstName"
type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="LastName"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
===================

Actually, such class as Generic List<> , ArrayList, custom Collection are
all .net specific, XML/XSD schemea does not have so specific definiation
for them. and it can only use a xml array or custom elemetn with sequential
elements to represent them.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top