SynchronizationOption Enumerazione

Definizione

Specifica il tipo di sincronizzazione automatica richiesto dal componente.

public enum class SynchronizationOption
[System.Serializable]
public enum SynchronizationOption
[<System.Serializable>]
type SynchronizationOption = 
Public Enum SynchronizationOption
Ereditarietà
SynchronizationOption
Attributi

Campi

Disabled 0

COM+ ignora i requisiti di sincronizzazione del componente quando si determina il contesto relativo all'oggetto.

NotSupported 1

Un oggetto con questo valore non fa mai parte di una sincronizzazione, a prescindere dallo stato del relativo chiamante. Questa impostazione è disponibile solo per i componenti non transazionali che non utilizzano l'attivazione JIT (Just-In-Time).

Required 3

Consente la sincronizzazione di tutti gli oggetti creati dal componente.

RequiresNew 4

Un oggetto con questo valore deve essere inserito in una nuova sincronizzazione in cui contesti e apartment siano gestiti da COM+ per tutti i componenti coinvolti nella chiamata.

Supported 2

Un oggetto con questo valore è incluso nella sincronizzazione, se presente.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso SynchronizationOption del tipo.

#using <System.EnterpriseServices.dll>

using namespace System;
using namespace System::EnterpriseServices;

// 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 ref class SynchronizationAttribute_SynchronizationDisabled :
    public 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 ref class SynchronizationAttribute_SynchronizationNotSupported :
    public ServicedComponent
{
};

// An instance of this class will join its caller's activity if one exists.
[Synchronization(SynchronizationOption::Supported)]
public ref class SynchronizationAttribute_SynchronizationSupported :
    public 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 ref class SynchronizationAttribute_SynchronizationRequired :
    public ServicedComponent
{
};

// A new activity will always be created for an instance of this class.
[Synchronization(SynchronizationOption::RequiresNew)]
public ref class SynchronizationAttribute_SynchronizationRequiresNew :
    public ServicedComponent
{
};
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
{
}
Imports System.EnterpriseServices
Imports 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
    Inherits ServicedComponent
End Class

' 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
    Inherits ServicedComponent
End Class

' An instance of this class will join its caller's activity if one exists.
<Synchronization(SynchronizationOption.Supported)>  _
Public Class SynchronizationAttribute_SynchronizationSupported
    Inherits ServicedComponent
End Class

' 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
    Inherits ServicedComponent
End Class

' A new activity will always be created for an instance of this class.
<Synchronization(SynchronizationOption.RequiresNew)>  _
Public Class SynchronizationAttribute_SynchronizationRequiresNew
    Inherits ServicedComponent
End Class

Si applica a