Bagikan melalui


BindingElement Class

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

The elements of the bindings that build the channel factories for various types of channels that are used to process outgoing messages on a Silverlight client.

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

Syntax

'Declaration
Public MustInherit Class BindingElement
public abstract class BindingElement

The BindingElement type exposes the following members.

Constructors

  Name Description
Protected methodSupported by Silverlight for Windows Phone BindingElement() Initializes a new instance of the BindingElement class.
Protected methodSupported by Silverlight for Windows Phone BindingElement(BindingElement) Initializes a new instance of the BindingElement class from a specified binding element.

Top

Methods

  Name Description
Public methodSupported by Silverlight for Windows Phone BuildChannelFactory<TChannel> Initializes a channel factory for producing channels of a specified type from the binding context.
Public methodSupported by Silverlight for Windows Phone CanBuildChannelFactory<TChannel> Returns a value that indicates whether the binding element can build a channel factory for a specific type of channel.
Public methodSupported by Silverlight for Windows Phone Clone When overridden in a derived class, returns a copy of the binding element object.
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 GetProperty<T> When overridden in a derived class, returns a typed object requested, if present, from the appropriate layer in the binding stack.
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 binding consists of an ordered set of binding elements that inherit from this abstract base class. For example, the TransportBindingElement class, which is the only binding element required by the service model in a binding, inherits from the BindingElement class.

Creating a binding and binding element for your transport is optional if you are just using the channel model. It is possible to do everything you need through the channel factory as long as it is made public.

The service model uses a factory pattern where the binding is used to create the channel stack. If you want to use the service model, then using a transport binding element is required. Placing this binding element into a binding is a good practice because it removes the requirement for users to create their own custom binding for your transport.

On the sending side, a binding is used to build a IChannelFactory, which in turn builds a channel stack and returns a reference to the top channel in the stack. The application can then use this channel to send messages.

Examples

The following example shows how to add a transport binding element to a custom binding and then build a channel listener that can accept incoming messages.

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.