IInstanceProvider::GetInstance Method (InstanceContext^, Message^)
Returns a service object given the specified InstanceContext object.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Parameters
- instanceContext
-
Type:
System.ServiceModel::InstanceContext^
The current InstanceContext object.
- message
-
Type:
System.ServiceModel.Channels::Message^
The message that triggered the creation of a service object.
Use the GetInstance(InstanceContext^, Message^) 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.
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.
Available since 3.0