A DataContract
is a formal agreement between a service and a client on how data will be exchanged. It also describes how data is to be serialized. A DataContract
is used when complex data types are needed to be exchanged between the server and client. A class has to be marked with the DataContract
attribute for it to be serialized and exposed in the WCF Service. Any class that does not have the DataContract
attribute is not accessible in the WCF Service.
Data Contracts are used by Service Contracts like primitive data types. DataContract
objects can be passed as parameters for Service Contracts or returned as values for the Service Contracts.
For more information you can refer to the MSDN article: Using Data Contracts
A ServiceContract
is a method that is exposed in a WCF Service, which a client calls to execute the service. The ServiceContract
almost always has a return value exposed to the client to check if it was successful, or to see if there are any results. A ServiceContract
uses Data Contracts to transfer data to and from the client. It can also use primitive data types to transfer data.
For more information you can refer to the MSDN article: Designing Service Contracts
Products |
Support |
Feedback: Data Contracts and Service Contracts (WCF) |
Introduction |
Help Version 19.0.2017.6.21
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.