This topic has not yet been rated - Rate this topic

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.

  Name Description
Public property Static member Current Gets or sets the ambient transaction.
Public property IsolationLevel Gets the isolation level of the transaction.
Public property TransactionInformation Retrieves additional information about a transaction.
Top
  Name Description
Public method Clone Creates a clone of the transaction.
Public method DependentClone Creates a dependent clone of the transaction.
Public method Dispose Releases the resources that are held by the object.
Public method EnlistDurable(Guid, IEnlistmentNotification, EnlistmentOptions) Enlists a durable resource manager that supports two phase commit to participate in a transaction.
Public method EnlistDurable(Guid, ISinglePhaseNotification, EnlistmentOptions) Enlists a durable resource manager that supports single phase commit optimization to participate in a transaction.
Public method EnlistPromotableSinglePhase Enlists a resource manager that has an internal transaction using a promotable single phase enlistment (PSPE).
Public method EnlistVolatile(IEnlistmentNotification, EnlistmentOptions) Enlists a volatile resource manager that supports two phase commit to participate in a transaction.
Public method EnlistVolatile(ISinglePhaseNotification, EnlistmentOptions) Enlists a volatile resource manager that supports single phase commit optimization to participate in a transaction.
Public method Equals Determines whether this transaction and the specified object are equal. (Overrides Object.Equals(Object).)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Returns the hash code for this instance. (Overrides Object.GetHashCode().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Rollback() Rolls back (aborts) the transaction.
Public method Rollback(Exception) Rolls back (aborts) the transaction.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top
  Name Description
Public event TransactionCompleted Indicates that the transaction is completed.
Top
  Name Description
Public operator Static member Equality Tests whether two specified Transaction instances are equivalent.
Public operator Static member Inequality Returns a value that indicates whether two Transaction instances are not equal.
Top
  Name Description
Explicit interface implemetation Private method ISerializable.GetObjectData Gets 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.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ