forked from openrasta/archived-openrasta-legacy
-
Notifications
You must be signed in to change notification settings - Fork 1
XmlDataContractCodec
simonthorogood edited this page Dec 12, 2010
·
1 revision
OpenRasta supports serialization of a resource using XML Data Contract serialization. This is a fast, simple form of serialization that does not support attributes.
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);
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.
Use the XmlDataContractCodec
when you want a fast, simple XML representation of a resource which does not use attributes.