What is DataContract and ServiceContract?Explain
Answer Posted / vijay krishna
Data represented by creating DataContract which expose the
data which will be transefered /consumend from the serive
to its clients.
**Operations which is the functions provided by this
service.
To write an operation on WCF,you have to write it as an
interface,This interface contains the "Signature" of the
methods tagged by ServiceContract attribute,and all methods
signature will be impelemtned on this interface tagged with
OperationContract attribute.
and to implement these serivce contract you have to create
a class which implement the interface and the actual
implementation will be on that class.
Code Below show How to create a Service Contract:
[ServiceContract]
Public Interface IEmpOperations
{
[OperationContract]
Decimal Get EmpSal(int EmpId);
}
Class MyEmp: IEmpOperations
{
Decimal Get EmpSal()
{
// Implementation of this method.
}
}
Hope now you can differentiate between Data
Contract,Service Contract and OperationContract.
| Is This Answer Correct ? | 22 Yes | 6 No |
Post New Answer View All Answers
What is wcf basic binding type?
How to perform Transaction query in WCF?
When was wcf introduced?
Can you explain how end points, contract, address and bindings are done in wcf?
How do you choose the hosting for wcf internet service?
Plz any one send the sharepoint interview question @ mossdev123@gmail.com
explain what is transport and message reliability? : Wcf data services
What is contract? What are the types of contract?
Define the term policy binding?
explain wcf basic binding type? : Wcf data services
what are the different instance modes in WCF?
What wcf stands for?
What are the essential components used in wcf?
Define message contracts?
How we can achieve operation overloading while exposing wcf services?