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
How to configure reliability while communicating with wcf services?
what is wcf peer network binding type? : Wcf data services
How to host WCF Self-Hosting?
Explain the wcf ria?
Explain data contracts?
What is datacontractserializer and how its different from xmlserializer?
What is the proxy for wcf service?
Explain fault contracts?
What are the transport schemes supported by wcf? Give example of address for each scheme.
Elucidate on the various contracts in wcf?
Define message contracts?
What are wcf service endpoints? Explain.
what is windows card space?
How we can use MessageContract partially with DataContract for a service operation in WCF?
Explain wcf tcp binding type?