Oct 27, 2015

how much types of serialization support wcf

Basically WCF supports three types of serialization :
 XMLSerializer
 NetDataContractSerializer
 DataContractSerializer


XMLSerializer

We can find XMLSerializer in the System.Xml.Serialization namespace. WCF supports this serialization from .Net 1.0. It is used by default with the ASP.Net webservices (ASMX).

Usage
  • We can use this serializer whenever we want to get backward compatibility with ASMX.
  • It can also be used when integrating with non WCF Services.
NetDataContractSerializer

NetDataContractSerializer is analogous to .Net Remoting Formatters. It implements IFormatter and it is compatible with [Serializable] types. It is not recommended for service oriented design.

Usage
  • It is used when we have WCF services at both sides.
  • It is easier when we want to migrate .Net remoting applications.
DataContractSerializer

DataContractSerializer is a default serializer for WCF. We need not to mention DataContractSerializer attribute above the service contract. 

Usage
  • Used by default unless we specify otherwise.
  • It is the best choice for code-first designs.

No comments:

Post a Comment