Export (0) Print
Expand All

IContractBehaviorAttribute Interface

Specifies the contract for which an attribute that implements the System.ServiceModel.Description.IContractBehavior interface is active.

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

type IContractBehaviorAttribute =  interface end

The IContractBehaviorAttribute type exposes the following members.

  NameDescription
Public propertyTargetContractGets the type of the contract to which the contract behavior is applicable.
Top

Implement the IContractBehaviorAttribute interface on an attribute that is also an System.ServiceModel.Description.IContractBehavior object to enable the use of that contract behavior attribute on a service type but restrict its application to the contract specified in the TargetContract property.

There is no requirement to implement IContractBehaviorAttribute on custom contract behavior attributes, and if the attribute is applied either to a contract interface or to a duplex callback class the value of the TargetContract property is ignored.

For more information, see System.ServiceModel.Description.IContractBehavior.

The following code example assumes a custom System.ServiceModel.Dispatcher.IInstanceProvider implementation called ObjectProviderBehavior that provides a "singleton" behavior; it always returns the same service instance and does not recycle it.

To insert the instance provider customization, the example shows how to implement a custom attribute (SingletonBehaviorAttribute) that implements System.ServiceModel.Description.IContractBehavior to insert the custom service instance provider. It also implements IContractBehaviorAttribute, which binds its application to the ISampleService contract.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft