Welcome to MSDN Blogs Sign in | Join | Help

No Choice for Data Contracts

I have a schema file that describes a choice between multiple layout formats for a type. How do I build a proxy that matches this schema?

The reason that this is probably not working is because DataContractSerializer for the most part does not support ambiguous, optional, or multiply-described sections of types. Using svcutil and specifying the serializer to be XmlSerializer is more likely to generate the expected proxy type.

Here's a rough guide to what DataContractSerializer does not support for complex type content. If you're using any of these features in your schema, then it's likely that you'll need to use XmlSerializer instead.

  • Attributes (pretty much everything related to attributes including groups and wildcards)
  • Group, all, or choice selections
  • Extensions or restrictions of simple content (except for restrictions from anySimpleType)
  • Sequences that are optional or repeating (minOccurs or maxOccurs not equal to 1)
  • Sequences that contain other sequences or wildcard content

Next time: Using ETW Tracing

Published Monday, September 29, 2008 5:00 AM by Nicholas Allen

Comments

Monday, September 29, 2008 12:19 PM by Nicholas Allen's Indigo Blog

# Hosted Service Shutdown

I've talked a bit in the past about the tradeoffs of using IIS to host your service applications. In

New Comments to this post are disabled
 
Page view tracker