IInstanceProvider::GetInstance Method (InstanceContext^)

 

Returns a service object given the specified InstanceContext object.

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

Object^ GetInstance(
	InstanceContext^ instanceContext
)

Parameters

instanceContext
Type: System.ServiceModel::InstanceContext^

The current InstanceContext object.

Return Value

Type: System::Object^

A user-defined service object.

Use the GetInstance(InstanceContext^) method to control the exact service object that a WCF service receives when it attempts to create a new one.

The following code example shows how to implement IInstanceProvider that provides "singleton" behavior; it always returns the same service instance and does not recycle it.

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

The following code example shows how to implement a custom attribute that implements IContractBehavior to insert the custom service instance provider. It also implements IContractBehaviorAttribute, which binds its use to a specific contract.

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

.NET Framework
Available since 3.0
Return to top
Show: