WCF (Windows Communication Foundation) Question:

Explain What is DataContract and ServiceContract?

Tweet Share WhatsApp

Answer:

Service Contract:
Service contracts describe the operation that service can
provide. For Eg, a Service provide to know the temperature
of the city based on the zip code, this service is called as
Service contract. It will be created using Service and
Operational Contract attribute.

Data Contract:

Data contract describes the custom data type which is
exposed to the client. This defines the data types, that are
passed to and from service. Data types like int, string are
identified by the client because it is already mention in
XML schema definition language document, but custom created
class or data types cannot be identified by the client e.g.
Employee data type. By using DataContract we can make client
to be aware of Employee data type that are returning or
passing parameter to the method.

Download WCF (Windows Communication Foundation) PDF Read All 13 WCF (Windows Communication Foundation) Questions
Previous QuestionNext Question
Explain Different ways to host WCF service?Could the IIS-hosted WCF service make use of HTTP transport security if the IIS virtual derectory that contains the service does not support it?