次の方法で共有


IOperationBehavior Interface

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

Implements methods that can be used to extend run-time behavior for an operation in a Silverlight application.

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

Syntax

'Declaration
Public Interface IOperationBehavior
public interface IOperationBehavior

The IOperationBehavior type exposes the following members.

Methods

  Name Description
Public method AddBindingParameters Implement to pass data at runtime to bindings to support custom behavior.
Public method ApplyClientBehavior Implements a modification or extension of the client across an operation.
Public method ApplyDispatchBehavior This method is not used with Silverlight 5 applications.
Public method Validate Implement to confirm that the operation meets some intended criteria.

Top

Remarks

Implement the IOperationBehavior interface to modify, examine, or extend some aspect of operation-wide execution at the application level for Silverlight client applications.

  • Use the AddBindingParameters method to pass custom data at runtime to enable bindings to support custom behavior.

  • Use the ApplyClientBehavior method to modify, examine, or insert extensions to a client dispatcher in a client application.

  • The ApplyDispatchBehavior method is not used in Silverlight 5.

  • Use the Validate method to confirm that a OperationDescription meets specific requirements. This can be used to ensure that an operation has a certain configuration setting enabled, supports a particular feature and other requirements.

IOperationBehavior objects can make use of any of these methods, but often only one is important; in such cases, the unused methods can return, performing no action.

NoteNote:

All of the IOperationBehavior methods pass an OperationDescription object as a parameter. This parameter is for examination only; if you modify the OperationDescription object the execution behavior is undefined.

IOperationBehavior objects are typically used to access the various properties of the System.ServiceModel.Dispatcher.DispatchOperation object in a service application and the System.ServiceModel.Dispatcher.ClientOperation object in a client application.

To perform a client customization task, the IOperationBehavior object must be added to the OperationDescription.Behaviors property before calling the ChannelFactory<TChannel>.CreateChannel method or the ICommunicationObject.Open method on ChannelFactory<TChannel>.

Although the operation behavior is designed for easy access to the runtime at the scope of an individual operation, you can access the runtime at a larger scope by accessing the parent runtime object.

Version Information

Silverlight

Supported in: 5, 4

Platforms

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