The fatigue is showing: I got the session code and the room number mixed up so went off looking for a non-existent room and have ended up sitting in the corridor watching the television. I met Doug at the Microsoft pavillion before the session and he's in fine form (so excited that he's losing his voice).
Some key points:
- Serialization is not the same as XML programming. Xml programming is using XSD to get CLR type. Serialization is about saving a CRL type to XSD or to another CLR type.
- Indigo uses a new attribute [DataContract] instead of [Serializable]. This is part of the general shift from the framework doing things invisibly, or by magic, to the new approach where the developer must opt-in. Developers must mark up the class with [DataContract] and the members with [DataMember]. Like other attributes in Indigo, these attributes don't care about the CLR's visibility because serializing into XML is not the same as controlling access to objects.
- It's possible to deserialize one CLR type into a different CLR type provided that the serialization class and member names match.
- [DataMember(VersionAdded = 2)] allows you to support versioning in schema.
How to version schemas
A group is added to the schema called 'UnknownData'. The previous approach that Doug mentioned at TechEd was the open content model. The downside of the open content model is that you lose the checking in future versions. UnknownData uses the open content model, but it includes a version number which means you can continue to extend the schema. This works in an interoperable way.