Data Contract in WCF

In my earlier blog I wrote about Other Contracts. Please refer this link Contracts in WCF
Here we will learn about Data Contract.

It is used to define the data which will be exchanged between client and server. 
A simple Data Contract with Data Member will look like this.

[DataContract]
public class Product
{
    private int _ProductID;
    private string _ProductName;
   
    [DataMember]
    public string PName
    {
        get { return _ProductName; }
        set { _ProductName = value; }
    }

    public int PID
    {
        get { return _ProductID; }
        set { _ProductID = value; }
    }


}

In next blog I will explain about DataContract Serialization.

Comments

Popular posts from this blog

CAML Query in SharePoint 2010

Calling REST APi from server side code - C#

All about SharePoint 2010 Content Type Hub

SharePoint Interview Questions and Answers

Calling ASP.Net WebMethod using jQuery AJAX