System.ServiceModel 4.0.0.0

Implement the interface to modify, examine, or extend some aspect of contract-wide execution at the application level. Unlike and objects, objects cannot be added to the runtime using an application configuration file; they can only be added programmatically or using an attribute.

For more information about choosing between service, endpoint, and contract behaviors, see Attaching Extensions Using Behaviors.

Use the method to provide binding elements with custom data to support the behavior.

Use the method to modify, examine, or insert extensions to a contract in a client application.

Use the method to modify, examine, or insert extensions to a contract in a service application.

Use the method to ensure that a contract can support a particular feature.

objects can make use of any of these methods, but often only one is important; in such cases, the unused methods can return without any value.

All of the methods pass and as parameters. These parameters are for examination; if you modify the objects the execution behavior is undefined.

types can be used on either the service or the client, or both. To perform a customization task on the service, the object must be added to the property prior to the construction of the service runtime, which occurs when the method is called on the object. There are two ways to do this.

The first method is to programmatically add the custom contract behavior to the property prior to the point when the method is called on the object. When applied this way, the behavior is applied for all messages flowing through that contract on any endpoint.

The behavior is applied to all contracts of the same type. For example, if you programmatically add the same contract type to more than one endpoint, the behavior modifies all endpoints that refer to the same contract object.

The second method is to create a custom attribute that implements and apply that to:

A contract interface. In this case, the behavior is applied to all contracts of that type in any endpoint.

A service class. In this case, the behavior is applied to all endpoints regardless of contract.

A callback class. In this case, the behavior is applied to the duplex client's endpoint.

The behavior of the second approach varies slightly if the custom attribute also implements . In this case, the behavior is as follows:

A contract interface. In this case, the behavior is applied to all contracts of that type in any endpoint and indigo1 ignores the value of the property.

A service class. In this case, the behavior is applied only to endpoints the contract of which is the value of the property.

A callback class. In this case, the behavior is applied to the duplex client's endpoint and indigo2 ignores the value of the property.

To perform the customization task on the client for which it is intended, the object must be added to the property prior to the construction of the client runtime, which occurs when is called. There are two ways to do this:

Programmatically add the custom contract behavior to the property prior to the point when the is called.

Create a custom attribute that also implements .

For more information on programmatically adding types to either the client or service application, see Attaching Extensions Using Behaviors.

Implements methods that can be used to extend run-time behavior for a contract in either a service or client application.

- Method
  4.0.0.0
  System.Void `` `` `` To be added. To be added.

  Implement the method to provide binding elements with the extra objects they require to support the contract behavior.

  This method is called once for each endpoint that uses the specified service contract.

  Configures any binding elements to support the contract behavior.

  The endpoint to modify.
- Method
  4.0.0.0
  System.Void `` `` `` To be added. To be added.

  Implement the method to view, modify, or add custom extensions to the client runtime across all messages or for one specific operation. For details about what customizations you can do with a client run-time object, see and .

  The method can throw a exception if the behavior is only intended for use in a service application.

  This method is called once for each endpoint that uses the specified service contract.

  Note that there can be two operations with the same name in the description (one in each direction), so if you must iterate through operations where the contract is a duplex contract, you must correlate the message direction between the endpoint and that returned by the property.

  Because other behaviors may have already added or removed some operations from the runtime, there is no guarantee that there are the same number of operations in the description as there are objects in the property.

  Implements a modification or extension of the client across a contract.

  The endpoint.
- Method
  4.0.0.0
  System.Void `` `` `` To be added. To be added.

  Implement the to view, modify, or add custom extensions to the service runtime across all messages in a specific contract or for one specific operation in that contract. For details about what customizations you can perform in a service application, see and .

  The method can throw a exception if the behavior is only intended for use in a client application.

  This method is called once for each endpoint that uses the specified service contract.

  Note that there can be two operations with the same name in the description (one in each direction), so if you must iterate through operations where the contract is a duplex contract, you must correlate the message direction between the endpoint and that returned by the property.

  In addition, because other behaviors may have already added or removed some operations from the runtime, there is no guarantee that there are the same number of operations in description as there are objects in the property.

  Implements a modification or extension of the client across a contract.

  The endpoint that exposes the contract.
- Method
  4.0.0.0
  System.Void `` `` To be added.

  Implement the method to confirm that the contract description is sufficient to support the custom contract behavior. Implementations can inspect the description and either throw or return no value.

  This method is called once for each endpoint that uses the specified service contract.

  Implement to confirm that the contract and endpoint can support the contract behavior.

  The endpoint to validate.