แก้ไข

แชร์ผ่าน


DbTransaction Class

Definition

Defines the core behavior of database transactions and provides a base class for database-specific transactions.

public ref class DbTransaction abstract : IDisposable
public ref class DbTransaction abstract : MarshalByRefObject, IAsyncDisposable, IDisposable, System::Data::IDbTransaction
public ref class DbTransaction abstract : IDisposable, System::Data::IDbTransaction
public ref class DbTransaction abstract : MarshalByRefObject, IDisposable, System::Data::IDbTransaction
public ref class DbTransaction abstract : MarshalByRefObject, System::Data::IDbTransaction
public ref class DbTransaction abstract : MarshalByRefObject, IAsyncDisposable, System::Data::IDbTransaction
public abstract class DbTransaction : IDisposable
public abstract class DbTransaction : MarshalByRefObject, IAsyncDisposable, IDisposable, System.Data.IDbTransaction
public abstract class DbTransaction : IDisposable, System.Data.IDbTransaction
public abstract class DbTransaction : MarshalByRefObject, IDisposable, System.Data.IDbTransaction
public abstract class DbTransaction : MarshalByRefObject, System.Data.IDbTransaction
public abstract class DbTransaction : MarshalByRefObject, IAsyncDisposable, System.Data.IDbTransaction
type DbTransaction = class
    interface IDisposable
type DbTransaction = class
    inherit MarshalByRefObject
    interface IDbTransaction
    interface IDisposable
    interface IAsyncDisposable
type DbTransaction = class
    interface IDbTransaction
    interface IDisposable
type DbTransaction = class
    inherit MarshalByRefObject
    interface IDbTransaction
    interface IDisposable
Public MustInherit Class DbTransaction
Implements IDisposable
Public MustInherit Class DbTransaction
Inherits MarshalByRefObject
Implements IAsyncDisposable, IDbTransaction, IDisposable
Public MustInherit Class DbTransaction
Implements IDbTransaction, IDisposable
Public MustInherit Class DbTransaction
Inherits MarshalByRefObject
Implements IDbTransaction, IDisposable
Public MustInherit Class DbTransaction
Inherits MarshalByRefObject
Implements IDbTransaction
Public MustInherit Class DbTransaction
Inherits MarshalByRefObject
Implements IAsyncDisposable, IDbTransaction
Inheritance
DbTransaction
Inheritance
DbTransaction
Derived
Implements

Constructors

DbTransaction()

Initializes a new DbTransaction object.

Properties

Connection

Specifies the DbConnection object associated with the transaction.

DbConnection

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

IsolationLevel

When overridden in a derived class, gets the isolation level for this transaction.

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.

Methods

Commit()

When overridden in a derived class, commits the database transaction.

CommitAsync(CancellationToken)

Asynchronously commits the database transaction.

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.

Dispose(Boolean)

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

DisposeAsync()

Asynchronously disposes the transaction object.

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.

ReleaseAsync(String, CancellationToken)

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

Rollback()

When overridden in a derived class, rolls back a transaction from a pending state.

Rollback(String)

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

RollbackAsync(CancellationToken)

Asynchronously rolls back a transaction from a pending state.

RollbackAsync(String, CancellationToken)

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

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.

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.

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.

Extension Methods

ConfigureAwait(IAsyncDisposable, Boolean)

Configures how awaits on the tasks returned from an async disposable will be performed.

Applies to

See also