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 would you enable the metadata information of the service?
Which protocol is used for platform independent communication?
What is wcf wpf wwf in net?
What is service and client in perspective of data communication?
tell me what is proxy and how to generate proxy for wcf services? : Wcf data services
When is the msmqintegrationbinding?
What are tha advantages of hosting wcf service in was?
what are the main components of WCF?
How can we create proxy for the wcf service?
What are the advantages of using wcf?
Could the iis-hosted wcf service make use of http transport security if the iis virtual derectory that contains the service does not support it?
What are different isolation levels?
What are WCF contracts?
What is .net 3.0?
What are the advantages of wcf?