Export (0) Print
Expand All

Transaction Class

Represents a transaction.

Namespace:  System.Transactions
Assembly:  System.Transactions (in System.Transactions.dll)

[SerializableAttribute]
public class Transaction : IDisposable, 
	ISerializable

The Transaction type exposes the following members.

  NameDescription
Public propertyStatic memberCurrentGets or sets the ambient transaction.
Public propertyIsolationLevelGets the isolation level of the transaction.
Public propertyTransactionInformationRetrieves additional information about a transaction.
Top

  NameDescription
Public methodCloneCreates a clone of the transaction.
Public methodDependentCloneCreates a dependent clone of the transaction.
Public methodDisposeReleases the resources that are held by the object.
Public methodEnlistDurable(Guid, IEnlistmentNotification, EnlistmentOptions)Enlists a durable resource manager that supports two phase commit to participate in a transaction.
Public methodEnlistDurable(Guid, ISinglePhaseNotification, EnlistmentOptions)Enlists a durable resource manager that supports single phase commit optimization to participate in a transaction.
Public methodEnlistPromotableSinglePhaseEnlists a resource manager that has an internal transaction using a promotable single phase enlistment (PSPE).
Public methodEnlistVolatile(IEnlistmentNotification, EnlistmentOptions)Enlists a volatile resource manager that supports two phase commit to participate in a transaction.
Public methodEnlistVolatile(ISinglePhaseNotification, EnlistmentOptions)Enlists a volatile resource manager that supports single phase commit optimization to participate in a transaction.
Public methodEqualsDetermines whether this transaction and the specified object are equal. (Overrides Object.Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeReturns the hash code for this instance. (Overrides Object.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRollback()Rolls back (aborts) the transaction.
Public methodRollback(Exception)Rolls back (aborts) the transaction.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventTransactionCompletedIndicates that the transaction is completed.
Top

  NameDescription
Public operatorStatic memberEqualityTests whether two specified Transaction instances are equivalent.
Public operatorStatic memberInequalityReturns a value that indicates whether two Transaction instances are not equal.
Top

  NameDescription
Explicit interface implemetationPrivate methodISerializable.GetObjectDataGets a SerializationInfo with the data required to serialize this transaction.
Top

The System.Transactions namespace provides both an explicit programming model based on the Transaction class, as well as an implicit programming model using the TransactionScope class, in which transactions are automatically managed by the infrastructure. It is highly recommended that you use the easier implicit model for development. To get started, please see the Implementing An Implicit Transaction Using Transaction Scope topic. For more information on writing a transactional application, see Writing A Transactional Application.

The Transaction class contains methods used by developers implementing resource managers for enlistment. It also provides functionalities for cloning a transaction and controlling the current transaction context. You can obtain the current transaction, if one is set, using the static Current property.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

This type is thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft