Export (0) Print
Expand All
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

TransactionOption Enumeration

Specifies the automatic transaction type requested by the component.

Namespace: System.EnterpriseServices
Assembly: System.EnterpriseServices (in system.enterpriseservices.dll)

[SerializableAttribute] 
public enum TransactionOption
/** @attribute SerializableAttribute() */ 
public enum TransactionOption
SerializableAttribute 
public enum TransactionOption
 Member nameDescription
DisabledIgnores any transaction in the current context. 
NotSupportedCreates the component in a context with no governing transaction. 
RequiredShares a transaction, if one exists, and creates a new transaction if necessary. 
RequiresNewCreates the component with a new transaction, regardless of the state of the current context. 
SupportedShares a transaction, if one exists. 

When using the .NET Installation Tool (Regsvcs.exe), the transaction option for a ServicedComponent defaults to Disabled.

The following code example demonstrates the use of the TransactionOption type.

using System;
using System.EnterpriseServices;
using System.Reflection;

// References:
// System.EnterpriseServices

// An instance of this class will not participate in transactions, but can
// share its caller's context even if its caller is configured as
// NotSupported, Supported, Required, or RequiresNew.
[Transaction(TransactionOption.Disabled)]
public class TransactionAttribute_TransactionDisabled : ServicedComponent
{
}

// An instance of this class will not participate in transactions, and will
// share its caller's context only if its caller is also configured as
// NotSupported.
[Transaction(TransactionOption.NotSupported)]
public class TransactionAttribute_TransactionNotSupported : ServicedComponent
{
}

// An instance of this class will participate in its caller's transaction
// if one exists.
[Transaction(TransactionOption.Supported)]
public class TransactionAttribute_TransactionSupported : ServicedComponent
{
}

// An instance of this class will participate in its caller's transaction
// if one exists. If not, a new transaction will be created for it.
[Transaction(TransactionOption.Required)]
public class TransactionAttribute_TransactionRequired : ServicedComponent
{
}

// A new transaction will always be created for an instance of this class.
[Transaction(TransactionOption.RequiresNew)]
public class TransactionAttribute_TransactionRequiresNew : ServicedComponent
{
}

import System.*;
import System.EnterpriseServices.*;
import System.Reflection.*;

// References:
// System.EnterpriseServices
// An instance of this class will not participate in transactions, but can
// share its caller's context even if its caller is configured as
// NotSupported, Supported, Required, or RequiresNew.
/** @attribute Transaction(TransactionOption.Disabled)
 */
public class TransactionAttribute_TransactionDisabled extends ServicedComponent
{
} //TransactionAttribute_TransactionDisabled

// An instance of this class will not participate in transactions, and will
// share its caller's context only if its caller is also configured as
// NotSupported.
/** @attribute Transaction(TransactionOption.NotSupported)
 */
public class TransactionAttribute_TransactionNotSupported extends 
    ServicedComponent
{
} //TransactionAttribute_TransactionNotSupported

// An instance of this class will participate in its caller's transaction
// if one exists.
/** @attribute Transaction(TransactionOption.Supported)
 */
public class TransactionAttribute_TransactionSupported extends ServicedComponent
{
} //TransactionAttribute_TransactionSupported

// An instance of this class will participate in its caller's transaction
// if one exists. If not, a new transaction will be created for it.
/** @attribute Transaction(TransactionOption.Required)
 */
public class TransactionAttribute_TransactionRequired extends ServicedComponent
{
} //TransactionAttribute_TransactionRequired

// A new transaction will always be created for an instance of this class.
/** @attribute Transaction(TransactionOption.RequiresNew)
 */
public class TransactionAttribute_TransactionRequiresNew extends 
    ServicedComponent
{
} //TransactionAttribute_TransactionRequiresNew

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.