SynchronizationOption 列舉
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定元件要求的自動同步處理類型。
public enum class SynchronizationOption
[System.Serializable]
public enum SynchronizationOption
[<System.Serializable>]
type SynchronizationOption =
Public Enum SynchronizationOption
- 繼承
- 屬性
欄位
Disabled | 0 | COM+ 在決定物件的內容時會忽略元件的同步處理需求。 |
NotSupported | 1 | 具有這個值的物件從不參與同步處理,不論其呼叫端的狀態如何。 這個設定只供非交易元件使用,並且不使用 Just-In-Time (JIT) 啟動過程 (Activation)。 |
Required | 3 | 確保所有從元件建立的物件都會同步化。 |
RequiresNew | 4 | 具有這個值的物件必須參與新的同步處理,其中 COM+ 將代表涉及呼叫的所有元件來管理內容和 Apartment。 |
Supported | 2 | 如果它存在的話,具有這個值的物件會參與同步處理。 |
範例
下列程式代碼範例示範型別的使用 SynchronizationOption 。
#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