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:
-
Age is not a xs:int.
-
Name is not xs:string.
-
Age appears before Name in the outer sequence.
-
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;
}