in Technology by

 What is Data Contract in WCF?

1 Answer

0 votes
by

A data contract is a formal agreement between a service and a client that abstractly describes the data to be exchanged.

Data contract can be explicit or implicit. Simple type such as int, string etc has an implicit data contract. User defined object are explicit or Complex type, for which you have to define a Data contract using [DataContract] and [DataMember] attribute.

A data contract can be defined as follows:

  • It describes the external format of data passed to and from service operations.
  • It defines the structure and types of data exchanged in service messages.
  • It maps a CLR type to an XML Schema.
  • It defines how data types are serialized and deserialized. Through serialization, you convert an object into a sequence of bytes that can be transmitted over a network. Through deserialization, you reassemble an object from a sequence of bytes that you receive from a calling application.
  • It is a versioning system that allows you to manage changes to structured data.

data contract

  1. [DataContract]   
  2. public class CuboidInfo   
  3. {   
  4. }  

Related questions

0 votes
    Using the WCF web programming model one can specify an operation contract like so: [OperationContract] [WebGet ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    What is Fault Contract in WCF?...
asked Apr 2, 2021 in Education by JackTerrance
0 votes
    What is Message Contract in WCF?...
asked Apr 2, 2021 in Education by JackTerrance
0 votes
    What is Service Contract in WCF?...
asked Apr 1, 2021 in Education by JackTerrance
0 votes
    Enterprise system for managing contract review workflow is (1)COGS (2)CRS (3)CMS (4)CFM...
asked Sep 21, 2021 in Technology by JackTerrance
0 votes
    How are dApp different from a smart contract in Blockchain?...
asked Dec 26, 2020 in Technology by JackTerrance
0 votes
    The ‘Social Contract’ was written by (a) Aristotle (b) Machiavelli (c) Plato (d) Rousseau Select the correct answer from above options...
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    I am new to react and solidity however I am doing one project for just learning but I am unable ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    A formal contract between a Service Provider (SP) and a Service Consumer (SC) is known as a. Service Level ... d. Cloud Economic Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    A formal contract between a Service Provider (SP) and a Service Consumer (SC) is known as what? Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
0 votes
    Under the effect of that hormone, which organ of the female reproductive system starts to contract and thereby ... is facilitated? Select the correct answer from above options...
asked Nov 9, 2021 in Education by JackTerrance
0 votes
    How many types of contract does WCF defines?...
asked Mar 30, 2023 in Technology by JackTerrance
0 votes
    What are the differences between ASP.NET Web Service and WCF?...
asked Jul 26, 2021 in Technology by JackTerrance
0 votes
    What is one-way operation in WCF?...
asked Jul 26, 2021 in Technology by JackTerrance
...