what is service contract and operation contract in WCF

In WCF Service contract means ,it is the name of the attribute which is applied to an interface in a WCF service which is similar to the [WebServcie] attribute in the Webservice. 

Where as, Operation Contract means it is the name of the attribute which is applied to a method inside the interface of a wcf service which is similar to the [WebMethod] in WebService. 


this means, ServiceContract attribute is similar to the [WebServcie] attribute in the WebService and [OpeartionContract] is similar to the [WebMethod] in WebService. 



namespace WcfServiceLibSample
{
    [ServiceContract]
    public interface IMyService
    {
        [OperationContract]
        List<MyService> GetEmployee();

        [OperationContract]
        long AddEmployee(MyService Myservice);

        [OperationContract]
        long DeleteEmployee(string Id);

    }
}

0 Responses to “what is service contract and operation contract in WCF”

Post a Comment

Labels

Topics