BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

ReBlogger Contents

Previous posts in WSCF/WCF

 
 
Page 17446 of 20233

DataContract Projection, Part I

Blogger : meta-douglasp
All posts : All posts by meta-douglasp
Category : WSCF/WCF
Blogged date : 2005 May 15

Now that Indigo is starting to roll into the hands of more developers, I think I`ll start talking more about it.

The first item I want to discuss is how a DataContract is "projected" into XSD.

This is going to be a multi-part post, as I get bored quickly and I have children. ;-)

Suppose I have the below:

    [DataContract]
    class Person
    {
        [DataMember]
        string Name;
        [DataMember]
        int Age;
    }

Which yields the following XSD (using dc.exe -- included with Indigo):

http://schemas.datacontract.org/2004/07/ConsoleApplication1" 

xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/"
elementFormDefault="qualified"
targetNamespace="http://schemas.datacontract.org/2004/07/ConsoleApplication1"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
  http://schemas.microsoft.com/2003/10/Serialization/" />
 
   
     
     
     
       
       
     

   

   
 

 

Note a couple of things about this schema:

  1. Age is not a xs:int.
  2. Name is not xs:string.
  3. Age appears before Name in the outer sequence.
  4. There is some wacky nested sequence at the end of the outer sequence.

I`ll talk more about this in the next post, but here is a little hint that will start to explain the above:

    [DataContract]
    class Person
    {
        [DataMember]
        string Name;
 
        [DataMember]
        int Age;
	
	[DataMember(VersionAdded=2, MustUnderstand=true, SerializeAs=SerializationReferenceMode.Value)]
        string Address;
    }

Read comments or post a reply to : DataContract Projection, Part I
Page 17446 of 20233

Newest posts
 

    Email TopXML