Freigeben über


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.

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

Comments

  • Anonymous
    September 29, 2008
    I've talked a bit in the past about the tradeoffs of using IIS to host your service applications. In