What is WCF ? Fundamental of WCF ?
This article will tell you about WCF basics. By the end of this article you will be familiar with WCF basics and uses of WCF in ASP.net.
WCF is basically a programming model available in .net framework 3.0. It provides a platform for communication in ASP.Net. WCF works on some contracts.
So here is the brief about WCF.
WCF is a programming model in .Net framework 3.0.
WCF is made up with 3 parts, they are :Service, End Points and a host.
There is 'ABC' of WCF which is explained below:
A-Address: Where the service is available.
B-Binding: Describes how to communicate with services.
C-Contracts: Describes service implementation and service offer.
We will start with contract:Service contract:
Defines the behaviors and operations.
Example:
[ServiceContract]
public interface IEmployee
{
[OperationContract]
string AddEmployee( );
[OperationContract]
string deleteEmployee(string eid);
}Data Contract:
It defines the data member.
Example:
[DataContract]
public class EmployeeData
{
[DataMember]
public string empname = "";
[DataMember]
public string empid = "";
}Message Contract:
Message contract is nothing but the packet of information which WCF uses to transfer withing endpoints.
There are 3 ways of message: