What is DataContract and ServiceContract?Explain
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / pradeeprajasekharan
ServiceContract
Defines the Interface that is exposed through end points
which says what functionality will be available for the
client. So the ServiceContract attribute will be placed in
the interface level. Interface contains the definition of
the available methods through the service.
OperationalContract
Defines the methods under the service.
DataContract
Defines the mapping between CLR datatypes with XSD schema.
The complex datatypes will be serialized and deserialized
according to the DataContact attribute associated.
Is This Answer Correct ? | 13 Yes | 3 No |
Answer / sandeep
Service Contract:
Service contracts describe the operation that service can
provide. For Eg, a Service provide to know the temperature
of the city based on the zip code, this service is called as
Service contract. It will be created using Service and
Operational Contract attribute.
Data Contract:
Data contract describes the custom data type which is
exposed to the client. This defines the data types, that are
passed to and from service. Data types like int, string are
identified by the client because it is already mention in
XML schema definition language document, but custom created
class or data types cannot be identified by the client e.g.
Employee data type. By using DataContract we can make client
to be aware of Employee data type that are returning or
passing parameter to the method.
Is This Answer Correct ? | 3 Yes | 0 No |
What is endpoint in wcf service?
Tell me what is three major points in wcf? : Wcf data services
What is the main advantage of WAS?(Windows activation service) When it is used?
What is the difference between transport level and message level security?
What hosting functionality is unique for the vista os?
Can you define more than one endpoints in a service model?
What are various ways of hosting wcf services?
What is DataContract in WCF?
0 Answers Petranics Solutions,
What are the possible ways of hosting a wcf service? Explain.
Which protocol is used for platform independent communication?
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 the types of bindings in wcf?