What is Service Contract and Operational Contract Attributes in WCF Service

Last Reply on May 08, 2013 05:52 AM By Mudassar

Posted on May 07, 2013 04:39 AM

Hi

Can any one give me an idea about service contract and operational contract in details

Whether Service contract can be applied to class or only to the interface.

What are the advantage of the service contract and operational contract in addition.

thanks

Posted on May 08, 2013 05:52 AM

Service contract is actually applied to a WCF Service which actually is an interface and is inherited by a Class which defines the body of the methods.

All the methods in the Serice contract contain Attribute OperationContract

 ServiceContract attribute is similar to the [WebServcie] attribute in the WebService and [OperationContract] is similar to the [WebMethod] in WebService.

It just used to identify a Interface as an WCF Service and a method as an WCF Service method