Ray's playground

 

Serialization and Encoding(Essential Windows Communication Foundation)

  Deciding whether to use the DataContractSerializer, NetDataContractSerializer, XmlSerializer or the DataContractJsonSerializer is often an
easy decision. The DataContractSerializer should be the default serialization mechanism used because it is the native serialization mechanism for
WCF. However, if you have the need to support existing types or custom serialization not supported by the DataContractSerializer, you will most likely want to use the XmlSerializer. Although the NetDataContractSerializer is interesting, no direct support exists for using it without having to write code. Although some benefits exist to using the NetDataContractSerializer, its use is discouraged because it requires the sharing of types between the client and server. Finally, the DataContractJsonSerializer is used mostly in Web scenarios where services are being called from AJAX applications. If you plan to develop ASP.NET AJAX or Rich Internet Applications (RIAs) using Silverlight, you will most likely want to support JSON serialization using the DataContractJsonSerializer. Although JSON serialization is predominantly used within Web applications from JavaScript, its use is extended beyond Web applications because of its popularity. In these situations, the choice to use JSON becomes mostly a matter of personal preference. Finally, WCF provides a number of extensibility points that allow serialization to be completely replaced.

posted on 2010-04-01 16:47  Ray Z  阅读(279)  评论(0编辑  收藏  举报

导航