What are the different
options available to serialize complex types that are sent and received between
clients and services in WCF?
The following are the different options available to serialize complex types that are exchanged between clients and services in WCF.
These options have their own advantages and disadvantages.
Data contracts is the preferred way to serialize complex types in WCF.
1.
Serializable types - Us the
Serializable attribute on the type that you want to serialize
2. Data
contracts - Use DataContract
attribute on the type and DataMember attribute on every member of the type,
that you want to serialize. You can apply DataMember attribute either on a
filed or a property.
3.
Known types - Use Known types to
enable polymorphic behavior in service contracts.
4.
IXmlSerializable - IXmlSerializable
types provide XSD schema to Web Services
Description Language(WSDL)
and metadata exchange (MEX).
No comments :
Post a Comment