Transaction Transaction Transaction Transaction Class

Definition

Represents a transaction.

public ref class Transaction : IDisposable, System::Runtime::Serialization::ISerializable
[Serializable]
public class Transaction : IDisposable, System.Runtime.Serialization.ISerializable
type Transaction = class
    interface IDisposable
    interface ISerializable
Public Class Transaction
Implements IDisposable, ISerializable
Inheritance
TransactionTransactionTransactionTransaction
Derived
Attributes
SerializableAttribute
Implements

Remarks

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. We recommend highly that you use the easier implicit model for development. To get started, 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.

Properties

Current Current Current Current

Gets or sets the ambient transaction.

IsolationLevel IsolationLevel IsolationLevel IsolationLevel

Gets the isolation level of the transaction.

PromoterType PromoterType PromoterType PromoterType

Uniquely identifies the format of the byte[] returned by the Promote method when the transaction is promoted.

TransactionInformation TransactionInformation TransactionInformation TransactionInformation

Retrieves additional information about a transaction.

Methods

BeginCommitInternal(AsyncCallback) BeginCommitInternal(AsyncCallback) BeginCommitInternal(AsyncCallback) BeginCommitInternal(AsyncCallback)
Clone() Clone() Clone() Clone()

Creates a clone of the transaction.

DependentClone(DependentCloneOption) DependentClone(DependentCloneOption) DependentClone(DependentCloneOption) DependentClone(DependentCloneOption)

Creates a dependent clone of the transaction.

Dispose() Dispose() Dispose() Dispose()

Releases the resources that are held by the object.

EndCommitInternal(IAsyncResult) EndCommitInternal(IAsyncResult) EndCommitInternal(IAsyncResult) EndCommitInternal(IAsyncResult)
EnlistDurable(Guid, IEnlistmentNotification, EnlistmentOptions) EnlistDurable(Guid, IEnlistmentNotification, EnlistmentOptions) EnlistDurable(Guid, IEnlistmentNotification, EnlistmentOptions) EnlistDurable(Guid, IEnlistmentNotification, EnlistmentOptions)

Enlists a durable resource manager that supports two phase commit to participate in a transaction.

EnlistDurable(Guid, ISinglePhaseNotification, EnlistmentOptions) EnlistDurable(Guid, ISinglePhaseNotification, EnlistmentOptions) EnlistDurable(Guid, ISinglePhaseNotification, EnlistmentOptions) EnlistDurable(Guid, ISinglePhaseNotification, EnlistmentOptions)

Enlists a durable resource manager that supports single phase commit optimization to participate in a transaction.

EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification) EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification) EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification) EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification)

Enlists a resource manager that has an internal transaction using a promotable single phase enlistment (PSPE).

EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification, Guid) EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification, Guid) EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification, Guid) EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification, Guid)

Enlists a resource manager that has an internal transaction using a promotable single phase enlistment (PSPE).

EnlistVolatile(IEnlistmentNotification, EnlistmentOptions) EnlistVolatile(IEnlistmentNotification, EnlistmentOptions) EnlistVolatile(IEnlistmentNotification, EnlistmentOptions) EnlistVolatile(IEnlistmentNotification, EnlistmentOptions)

Enlists a volatile resource manager that supports two phase commit to participate in a transaction.

EnlistVolatile(ISinglePhaseNotification, EnlistmentOptions) EnlistVolatile(ISinglePhaseNotification, EnlistmentOptions) EnlistVolatile(ISinglePhaseNotification, EnlistmentOptions) EnlistVolatile(ISinglePhaseNotification, EnlistmentOptions)

Enlists a volatile resource manager that supports single phase commit optimization to participate in a transaction.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether this transaction and the specified object are equal.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Returns the hash code for this instance.

GetPromotedToken() GetPromotedToken() GetPromotedToken() GetPromotedToken()

Gets the byte[] returned by the Promote method when the transaction is promoted.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
PromoteAndEnlistDurable(Guid, IPromotableSinglePhaseNotification, ISinglePhaseNotification, EnlistmentOptions) PromoteAndEnlistDurable(Guid, IPromotableSinglePhaseNotification, ISinglePhaseNotification, EnlistmentOptions) PromoteAndEnlistDurable(Guid, IPromotableSinglePhaseNotification, ISinglePhaseNotification, EnlistmentOptions) PromoteAndEnlistDurable(Guid, IPromotableSinglePhaseNotification, ISinglePhaseNotification, EnlistmentOptions)

Promotes and enlists a durable resource manager that supports two phase commit to participate in a transaction.

Rollback() Rollback() Rollback() Rollback()

Rolls back (aborts) the transaction.

Rollback(Exception) Rollback(Exception) Rollback(Exception) Rollback(Exception)

Rolls back (aborts) the transaction.

SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification, Guid) SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification, Guid) SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification, Guid) SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification, Guid)

Sets the distributed transaction identifier generated by the non-MSDTC promoter.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Events

TransactionCompleted TransactionCompleted TransactionCompleted TransactionCompleted

Indicates that the transaction is completed.

Operators

Equality(Transaction, Transaction) Equality(Transaction, Transaction) Equality(Transaction, Transaction) Equality(Transaction, Transaction)

Tests whether two specified Transaction instances are equivalent.

Inequality(Transaction, Transaction) Inequality(Transaction, Transaction) Inequality(Transaction, Transaction) Inequality(Transaction, Transaction)

Returns a value that indicates whether two Transaction instances are not equal.

Explicit Interface Implementations

ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext)

Gets a SerializationInfo with the data required to serialize this transaction.

Applies to

Thread Safety

This type is thread safe.

See Also