IContractBehaviorAttribute::TargetContract Property

 

Gets the type of the contract to which the contract behavior is applicable.

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

property Type^ TargetContract {
	Type^ get();
}

Property Value

Type: System::Type^

The contract to which the contract behavior is applicable.

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.

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

.NET Framework
Available since 3.0
Return to top
Show: