DispatchRuntime.InstanceProvider DispatchRuntime.InstanceProvider DispatchRuntime.InstanceProvider DispatchRuntime.InstanceProvider Property

Definition

Gets or sets an IInstanceProvider object that you can use to control the creation and destruction of service objects.

public:
 property System::ServiceModel::Dispatcher::IInstanceProvider ^ InstanceProvider { System::ServiceModel::Dispatcher::IInstanceProvider ^ get(); void set(System::ServiceModel::Dispatcher::IInstanceProvider ^ value); };
[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public System.ServiceModel.Dispatcher.IInstanceProvider InstanceProvider { get; set; }
member this.InstanceProvider : System.ServiceModel.Dispatcher.IInstanceProvider with get, set
Public Property InstanceProvider As IInstanceProvider
Property Value

An IInstanceProvider object that controls the creation and destruction of service objects associated with an InstanceContext object.

Remarks

Implement the IInstanceProvider interface and assign the implementation to the InstanceProvider property to control instances of the service type using a constructor other than the default constructor, for example, to implement a custom instancing mode such as instance pooling.

Typically the GetInstance method is invoked once, when the InstanceContext object is first created. The ReleaseInstance method is also invoked once, when the InstanceContext object is closed.

A service can also be configured to release an instance before the InstanceContext object is closed. This can be configured by using the ReleaseInstanceMode property or by calling the ReleaseServiceInstance method. If this is done, the InstanceContext object calls the ReleaseInstance method. If a new message arrives after the instance has been released, a new instance is created using the GetInstance method.

Applies to