Redigera

Dela via


EntityTransaction Class

Definition

Specifies the transaction for an EntityCommand.

public ref class EntityTransaction sealed : System::Data::Common::DbTransaction
public sealed class EntityTransaction : System.Data.Common.DbTransaction
type EntityTransaction = class
    inherit DbTransaction
Public NotInheritable Class EntityTransaction
Inherits DbTransaction
Inheritance

Remarks

The EntityTransaction is obtained from the EntityConnection and specifies one or more EntityCommand objects. The EntityTransaction wraps the transaction of the underlying data provider's transaction object.

For code examples, see Managing Connections and Transactions.

Properties

Connection

Gets EntityConnection for this EntityTransaction.

DbConnection

When overridden in a derived class, gets the DbConnection object associated with the transaction.

(Inherited from DbTransaction)
IsolationLevel

Gets the isolation level of this EntityTransaction.

SupportsSavepoints

Gets a value that indicates whether this DbTransaction instance supports database savepoints. If false, the methods SaveAsync(String, CancellationToken), RollbackAsync(String, CancellationToken) and ReleaseAsync(String, CancellationToken) as well as their synchronous counterparts are expected to throw NotSupportedException.

(Inherited from DbTransaction)

Methods

Commit()

Commits the underlying transaction.

CommitAsync(CancellationToken)

Asynchronously commits the database transaction.

(Inherited from DbTransaction)
CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose()

Releases the unmanaged resources used by the DbTransaction.

(Inherited from DbTransaction)
Dispose(Boolean)

Releases the unmanaged resources used by the DbTransaction and optionally releases the managed resources.

(Inherited from DbTransaction)
DisposeAsync()

Asynchronously disposes the transaction object.

(Inherited from DbTransaction)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService()
Obsolete.

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService()
Obsolete.

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
Release(String)

Destroys a savepoint previously defined in the current transaction. This allows the system to reclaim some resources before the transaction ends.

(Inherited from DbTransaction)
ReleaseAsync(String, CancellationToken)

Destroys a savepoint previously defined in the current transaction. This allows the system to reclaim some resources before the transaction ends.

(Inherited from DbTransaction)
Rollback()

Rolls back the underlying transaction.

Rollback(String)

Rolls back all commands that were executed after the specified savepoint was established.

(Inherited from DbTransaction)
RollbackAsync(CancellationToken)

Asynchronously rolls back a transaction from a pending state.

(Inherited from DbTransaction)
RollbackAsync(String, CancellationToken)

Rolls back all commands that were executed after the specified savepoint was established.

(Inherited from DbTransaction)
Save(String)

Creates a savepoint in the transaction. This allows all commands that are executed after the savepoint was established to be rolled back, restoring the transaction state to what it was at the time of the savepoint.

(Inherited from DbTransaction)
SaveAsync(String, CancellationToken)

Creates a savepoint in the transaction. This allows all commands that are executed after the savepoint was established to be rolled back, restoring the transaction state to what it was at the time of the savepoint.

(Inherited from DbTransaction)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

IDbTransaction.Connection

Gets the DbConnection object associated with the transaction, or a null reference if the transaction is no longer valid.

(Inherited from DbTransaction)

Applies to

See also