DbTransaction 类

定义

定义数据库事务的核心行为,并为数据库专用事务提供基类。Defines the core behavior of database transactions and provides a base class for database-specific transactions.

public ref class DbTransaction abstract : MarshalByRefObject, IDisposable, System::Data::IDbTransaction
public abstract class DbTransaction : MarshalByRefObject, IDisposable, System.Data.IDbTransaction
type DbTransaction = class
    inherit MarshalByRefObject
    interface IDbTransaction
    interface IDisposable
Public MustInherit Class DbTransaction
Inherits MarshalByRefObject
Implements IDbTransaction, IDisposable
继承
DbTransaction
派生
实现

构造函数

DbTransaction()

初始化新的 DbTransaction 对象。Initializes a new DbTransaction object.

属性

Connection

指定与该事务关联的 DbConnection 对象。Specifies the DbConnection object associated with the transaction.

DbConnection

在派生类中重写时,获取与事务关联的 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.

方法

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.

(继承自 MarshalByRefObject)
Dispose()

释放 DbTransaction 使用的非托管资源。Releases the unmanaged resources used by the DbTransaction.

Dispose(Boolean)

释放 DbTransaction 使用的非托管资源,并选择性地释放托管资源。Releases the unmanaged resources used by the DbTransaction and optionally releases the managed resources.

DisposeAsync()

异步处置事务对象。Asynchronously diposes the transaction object.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
Rollback()

在派生类中重写时,从挂起状态回滚事务。When overridden in a derived class, rolls back a transaction from a pending state.

RollbackAsync(CancellationToken)

从挂起状态异步回滚事务。Asynchronously rolls back a transaction from a pending state.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式接口实现

IDbTransaction.Connection

获取与事务关联的 DbConnection 对象,或空引用(如果该事务不再有效)。Gets the DbConnection object associated with the transaction, or a null reference if the transaction is no longer valid.

适用于

另请参阅