What is DataContract and ServiceContract?Explain

Answer Posted / sandeep

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.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When was wcf introduced?

506


Explain wcf tcp binding type?

563


How do we customize data contract names for generics types?

595


What are the core components of wcf service?

524


WCF:What is it the Reliable session?

1544






Do we have to use the relative addresses when hosting in the iis or the absolute addresses? Why?

508


Why wcf service is used?

538


What are the types of bindings in wcf?

538


Explain wcf?

533


Which standard binding could be used for a service that was designed to replace an existing asmx web service?

488


What are the different modes of communication in wcf?

546


What do you understand by the term impersonation?

567


Explain use of Endpoints in WCF Service?

594


What is transport reliability in wcf?

566


What is "per session" instance mode in wcf?

591