1.

What Are Contracts In Wcf?

Answer»

In WCF, all SERVICES expose contracts. The contract is a platformneutral and standard WAY of DESCRIBING what the service does.

WCF defines four types of contracts.

Service contracts: Describe which operations the client can perform on the service.

There are two types of Service Contracts.

  • ServiceContract This attribute is used to define the Interface.
  • OperationContract This attribute is used to define the method inside Interface.

Data contracts: Define which data types are passed to and from the service. WCF defines implicit contracts for builtin types such as int and string, but we can easily define explicit optin data contracts for custom types.

There are two types of Data Contracts.

  • DataContract attribute
  • used to define the class
  • DataMember attribute
  • used to define the properties.

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

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 we have to COMPLY with.

In WCF, all services expose contracts. The contract is a platformneutral and standard way of describing what the service does.

WCF defines four types of contracts.

Service contracts: Describe which operations the client can perform on the service.

There are two types of Service Contracts.

Data contracts: Define which data types are passed to and from the service. WCF defines implicit contracts for builtin types such as int and string, but we can easily define explicit optin data contracts for custom types.

There are two types of Data Contracts.

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

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 we have to comply with.



Discussion

No Comment Found