IContractBehaviorAttribute::TargetContract Property
Gets the type of the contract to which the contract behavior is applicable.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Implement the TargetContract property to specify the contract to which the contract behavior is applied when the implementing System.ServiceModel.Description::IContractBehavior attribute is applied to a service class.
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.
Available since 3.0