Freigeben über


ContractDescription Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Describes a contract that specifies what an endpoint communicates to the outside world.

Inheritance Hierarchy

System.Object
  System.ServiceModel.Description.ContractDescription

Namespace:  System.ServiceModel.Description
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

Syntax

'Declaration
<DebuggerDisplayAttribute("Name={name}, Namespace={ns}, ContractType={contractType}")> _
Public Class ContractDescription
[DebuggerDisplayAttribute("Name={name}, Namespace={ns}, ContractType={contractType}")]
public class ContractDescription

The ContractDescription type exposes the following members.

Constructors

  Name Description
Public methodSupported by Silverlight for Windows Phone ContractDescription(String) Initializes a new instance of the ContractDescription class with a specified name.
Public methodSupported by Silverlight for Windows Phone ContractDescription(String, String) Initializes a new instance of the ContractDescription class with a namespace-qualified name specified.

Top

Properties

  Name Description
Public property Behaviors Gets the behaviors associated with the contract description.
Public propertySupported by Silverlight for Windows Phone CallbackContractType Gets or sets the type of callback contract that the contract description specifies.
Public propertySupported by Silverlight for Windows Phone ConfigurationName Gets or sets the configuration name for the contract description.
Public propertySupported by Silverlight for Windows Phone ContractType Gets or sets the contract type that the contract description specifies.
Public propertySupported by Silverlight for Windows Phone Name Gets or sets the name of the contract.
Public propertySupported by Silverlight for Windows Phone Namespace Gets or sets the namespace for the contract.
Public propertySupported by Silverlight for Windows Phone Operations Gets the collection of operation descriptions associated with the contract.

Top

Methods

  Name Description
Public methodSupported by Silverlight for Windows Phone Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows Phone Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetType Gets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows Phone MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

A contract is a collection of operations that specifies what the endpoint communicates to the outside world. Each operation is a message exchange. For example, a request message and an associated reply message form a request/reply message exchange.

A ContractDescription object is used to describe contracts and their operations. Within a ContractDescription, each contract operation has a corresponding OperationDescription object that describes aspects of each operation that is part of the contract, such as whether the operation is one-way or request/reply. Each OperationDescription object also describes the messages that make up the operation using a MessageDescriptionCollection object. The ContractDescription object also contains a reference to an interface that defines the contract using the programming model. This interface is marked with ServiceContractAttribute attribute and its methods that correspond to endpoint operations are each marked with the OperationContractAttribute attribute.

A duplex contract defines the following logical sets of operations:

  • A set that the service exposes for the client to call.

  • A set that the client exposes for the service to call.

The programming model for defining a duplex contract is to split each set in a separate interface and apply attributes to each interface. In this case, ContractDescription contains a reference to each of the interfaces that groups them into one duplex contract.

Similar to bindings, each contract has a Name and Namespace that uniquely identify it in the metadata of the service.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.