Click to Rate and Give Feedback
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
IInstanceContextProvider Interface

Implement to participate in the creation or choosing of a System.ServiceModel..::.InstanceContext object, especially to enable shared sessions.

Namespace:  System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel (in System.ServiceModel.dll)
Visual Basic (Declaration)
Public Interface IInstanceContextProvider
Visual Basic (Usage)
Dim instance As IInstanceContextProvider
C#
public interface IInstanceContextProvider
Visual C++
public interface class IInstanceContextProvider
JScript
public interface IInstanceContextProvider

Implement the IInstanceContextProvider interface to provide the appropriate System.ServiceModel..::.InstanceContext object to the system. Typically, this interface is implemented to support shared sessions, enable service instance pooling, control lifetimes of service instances, or to group contexts among clients.

For example, to implement sharing, insert a custom IInstanceContextProvider to decide which session or call from a client is associated with which InstanceContext object. For an example that demonstrates the sharing of instance contexts, see InstanceContextSharing.

Aa346528.alert_note(en-us,VS.90).gifNote:

When an IInstanceContextProvider is inserted into Windows Communication Foundation (WCF), the normal property that controls the creation of InstanceContext objects (the ServiceBehaviorAttribute..::.InstanceContextMode property) is no longer checked and has no effect.

A more generic mechanism by which you can initialize InstanceContext objects when created (for example, to attach custom extensions to each InstanceContext) is the System.ServiceModel.Dispatcher..::.IInstanceContextInitializer.

Windows Vista, Windows XP SP2, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker