WCF Examples


WCF Projects

WCF Project

WCF Contracts
Previous Home Next

In WCF, all services expose contracts. The contract is a platform-neutral and standard way of describing what the service does. WCF defines four types of contracts.

There are four Contracts:

  1. Service contracts: Define which operations the client can perform on the service. Service contracts are the subject of the next chapter, but are used extensively in every chapter in this book.

  2. Data contracts: Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string but you can easily define explicit opt-in data contracts for custom types

  3. Fault contracts: Define which errors are raised by the service, and how the service handles and propagates errors to its clients.

  4. Message contracts: Allow the service to interact directly with messages. Message contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format you have to comply with.

Previous Home Next