Wednesday, November 15, 2006

* WCF : Contracts

WCF has primarily three types of contracts :

service contract
The contract defines the name of the service, its namespace, and other global attributes. The contract is defined by creating an interface and applying the ServiceContractAttribute attribute to the interface.
operation contract
the operation contract define the parameters and return type of an operation. When creating an interface that defines the service contract, you also define the service operation contracts by applying the OperationContractAttribute attribute to each method definition.
data contract
The data types used by a service must be described in metadata to enable others to interoperate with the service. The descriptions of the data types are known as the data contract, and the types may be used in any part of a message, for example as parameters or return types.

1 comment:

  1. Hi Vikas
    I am new to WCF, I have written couple of serices in WCF, Now I want to Transfer the Objects Between Client and Service. How can I achieve it, I think we need to set DataContract. But I dont know how exactly, Alternatively, Can I Push Data from Service to the Client ? Please reply,
    Nilesh Joshi