A Contract is basically an agreement between the two parties i.e. Service and Client. In WCF, Contracts can be categorized as behavioral or structural.
- Behavioral Contracts define that what operations client can perform on a service.
- ServiceContract attribute is used to mark a type as Service contract that contains operations.
- OperationContract attributes is used to mark the operations that will be exposed.
- Fault Contract defines what errors are raised by the service being exposed.
- Structural Contracts
- DataContract attribute define types that will be moved between the parties.
- MessageContract attribute define the structure of SOAP message.