TracNav
OpenRasta's Documentation...
- Release Notes
- FAQs
Downloading/Building OpenRasta...
- Download from source
- Download the binaries
- Run the test suite
- .NET versions support
Using OpenRasta...
- Configuration how-tos
What you need to know about dependency injection
Tutorials
Building web-sites with OpenRasta...
- Supporting clients that only know GET and POST
Reference...
Hosting
Configuration
Modules
Pipeline...
- Pipeline contributors
- Well-known contributors
- PipelineContinuation members
Resources
Handlers
Binding...
- Object binders
- The default resource binder?
- ChangeSet<T> support?
Codecs...
- The Webforms Codec
- The XmlSerializer codec
- The JsonDataContract codec
- The XmlDataContract codec
Building Codecs...
- Building a media type reader
- Building a media type writer
- MediaType attribute
- Implementing configuration for ICodec
- Supporting binders and ChangeSet<> in a codec?
Using the XmlDataContractCodec
OpenRasta supports serialization of a resource using XML Data Contract serialization. This is a fast, simple form of serialization that does not support attributes.
Registering the codec
Whenever you want to render a resource using the XmlDataContractCodec, use the following form:
ResourceSpace.Has.ResourcesOfType<Customer>() /* your handler declaration */ .AsXmlDataContract();
This is shorthand for:
ResourceSpace.Has.ResourcesOfType<Customer>() /* your handler declaration */ .TranscodedBy<XmlDataContractCodec>(null);
Serialization considerations
As with the JsonDataContractCodec, it is not necessary to decorate your resource type with System.Runtime.Serialization attributes such as DataContract and DataMember. Doing so, however, will allow finer control over the naming and ordering of the resulting output.
When to use
Use the XmlDataContractCodec when you want a fast, simple XML representation of a resource which does not use attributes.
