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
Which are the various programming approaches for wcf?
What is transport reliability in wcf?
do you know what is the address formats of the wcf transport schemas? : Wcf data services
What is "singleton" instance mode in wcf?
How to Implement security in wcf rest service?
What is service host factory in wcf?
what is windows card space?
What are the core components of wcf service?
What are the various address format in WCF?
What are different bindings supported by wcf?
What do you mean by client?
Plz any one send the sharepoint interview question @ mossdev123@gmail.com
Explain the wcf ria?
How to deal with operation overloading while exposing the wcf services?
How many Instance modes is supported by WCF?