Total Pageviews

Sunday, August 26, 2012

Data Contracts and serialization

WCF has DataContractSerializer as its own dataformatter. It captures only the state of the object according to the serialization nor the data contract schema.

.Net Formatters - -2 types  for serialziing and deserialying  types.

Binay Formatter -- serilizes into a comact binat format, enabling fast seriazlianton and deserialzation.
Soap Foratter -- uses .net specific SOAP XML format. bith support IFormatter interface.

DataContractSerializer fromater does not support IFormatter.
NetDataContractSerializer is similar to .Net formatters the NetDataContractSerializercaptures the type infor and also the state of the object.Its a compliemnt to DataContractSerialize.

This capability of using NetDataContractSerializer to serialize and DataContractSerializer to deserialize opens a way for versioning tolerance and for migrating the legacycode that shares type infor into more soa approach where only the dtat schema is maintained.


Data Contracts
Data Contract attribute is used at the class level and to serialize its memebres we use dataMember attribute.
When a data contract is used in the contract operation, it is published in the service metadata.

No comments:

Post a Comment