IInstanceContextProvider IInstanceContextProvider IInstanceContextProvider IInstanceContextProvider Interface

Definição

Implementar participar da criação ou escolha de um objeto InstanceContext, especialmente para habilitar sessões compartilhadas.Implement to participate in the creation or choosing of a InstanceContext object, especially to enable shared sessions.

public interface class IInstanceContextProvider
public interface IInstanceContextProvider
type IInstanceContextProvider = interface
Public Interface IInstanceContextProvider

Comentários

Implemente IInstanceContextProvider a interface para fornecer o System.ServiceModel.InstanceContext objeto apropriado ao sistema.Implement the IInstanceContextProvider interface to provide the appropriate System.ServiceModel.InstanceContext object to the system. Normalmente, essa interface é implementada para dar suporte a sessões compartilhadas, habilitar o pooling de instância de serviço, controlar o tempo de vida de instâncias de serviço ou agrupar contextos entre clientes.Typically, this interface is implemented to support shared sessions, enable service instance pooling, control lifetimes of service instances, or to group contexts among clients.

Por exemplo, para implementar o compartilhamento, insira um IInstanceContextProvider personalizado para decidir qual sessão ou chamada de um cliente está associada a InstanceContext qual objeto.For example, to implement sharing, insert a custom IInstanceContextProvider to decide which session or call from a client is associated with which InstanceContext object. Para obter um exemplo que demonstra o compartilhamento de contextos de instância, consulte InstanceContextSharing.For an example that demonstrates the sharing of instance contexts, see InstanceContextSharing.

Observação

Quando um IInstanceContextProvider é inserido no Windows Communication Foundation (WCF), a propriedade normal que controla a criação de InstanceContext objetos (a ServiceBehaviorAttribute.InstanceContextMode Propriedade) não é mais verificada e não tem efeito.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.

Um mecanismo mais genérico pelo qual você pode inicializar InstanceContext objetos quando criado (por exemplo, para anexar extensões personalizadas a cada InstanceContext) é o System.ServiceModel.Dispatcher.IInstanceContextInitializer.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.

Métodos

GetExistingInstanceContext(Message, IContextChannel) GetExistingInstanceContext(Message, IContextChannel) GetExistingInstanceContext(Message, IContextChannel) GetExistingInstanceContext(Message, IContextChannel)

Chamado quando uma nova mensagem é recebida.Called when a new message is received.

InitializeInstanceContext(InstanceContext, Message, IContextChannel) InitializeInstanceContext(InstanceContext, Message, IContextChannel) InitializeInstanceContext(InstanceContext, Message, IContextChannel) InitializeInstanceContext(InstanceContext, Message, IContextChannel)

Chamado quando null é retornado do método GetExistingInstanceContext(Message, IContextChannel).Called when null is returned from the GetExistingInstanceContext(Message, IContextChannel) method.

IsIdle(InstanceContext) IsIdle(InstanceContext) IsIdle(InstanceContext) IsIdle(InstanceContext)

Chamado quando todas as atividades InstanceContext foram concluídas para permitir que os implementadores impeçam a reciclagem do InstanceContext.Called when all InstanceContext activities have completed to enable implementers to prevent the InstanceContext from being recycled.

NotifyIdle(InstanceContextIdleCallback, InstanceContext) NotifyIdle(InstanceContextIdleCallback, InstanceContext) NotifyIdle(InstanceContextIdleCallback, InstanceContext) NotifyIdle(InstanceContextIdleCallback, InstanceContext)

Chamado quando o IsIdle(InstanceContext) método retorna false para permitir que os implementadores forneçam um retorno de chamada para notificar o WCF quando o objeto InstanceContext é concluído.Called when the IsIdle(InstanceContext) method returns false to enable implementers to provide a callback to notify WCF when the InstanceContext object is finished.

Aplica-se a