Ler em inglês

Partilhar via


SynchronizationOption Enumeração

Definição

Especifica o tipo de sincronização automática solicitada pelo componente.

C#
[System.Serializable]
public enum SynchronizationOption
Herança
SynchronizationOption
Atributos

Campos

Nome Valor Description
Disabled 0

O COM+ ignora os requisitos de sincronização do componente ao determinar o contexto para o objeto.

NotSupported 1

Um objeto com esse valor nunca participa da sincronização, independentemente do status de seu chamador. Essa configuração só está disponível para os componentes que não são transacionais e não usam a ativação JIT (Just-In-Time).

Required 3

Garante que todos os objetos criados com base no componente estejam sincronizados.

RequiresNew 4

Um objeto com esse valor deve participar de uma nova sincronização em que o COM+ gerencia apartments e contextos em nome de todos os componentes envolvidos na chamada.

Supported 2

Um objeto com esse valor participará da sincronização, se ele existir.

Exemplos

O exemplo de código a seguir demonstra o uso do SynchronizationOption tipo.

C#
using System;
using System.EnterpriseServices;
using System.Reflection;

// References:
// System.EnterpriseServices

// An instance of this class will not join an activity, but can share its
// caller's context even if its caller is configured as NotSupported,
// Supported, Required, or RequiresNew.
[Synchronization(SynchronizationOption.Disabled)]
public class SynchronizationAttribute_SynchronizationDisabled :
    ServicedComponent
{
}

// An instance of this class will not join an activity, and will share its
// caller's context only if its caller is also configured as NotSupported.
[Synchronization(SynchronizationOption.NotSupported)]
public class SynchronizationAttribute_SynchronizationNotSupported :
    ServicedComponent
{
}

// An instance of this class will join its caller's activity if one exists.
[Synchronization(SynchronizationOption.Supported)]
public class SynchronizationAttribute_SynchronizationSupported :
    ServicedComponent
{
}

// An instance of this class will join its caller's activity if one exists.
// If not, a new activity will be created for it.
[Synchronization(SynchronizationOption.Required)]
public class SynchronizationAttribute_SynchronizationRequired :
    ServicedComponent
{
}

// A new activity will always be created for an instance of this class.
[Synchronization(SynchronizationOption.RequiresNew)]
public class SynchronizationAttribute_SynchronizationRequiresNew :
    ServicedComponent
{
}

Aplica-se a

Produto Versões
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1