Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Henrik Skak Pedersen - 13 Dec 2006 21:04 GMT
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.
Steven Cheng[MSFT] - 14 Dec 2006 06:17 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.