RelationalConnection.UseTransactionAsync 方法

定义

重载

UseTransactionAsync(DbTransaction, Guid, CancellationToken)

指定用于数据库操作的现有 DbTransaction

UseTransactionAsync(DbTransaction, CancellationToken)

指定用于数据库操作的现有 DbTransaction

UseTransactionAsync(DbTransaction, Guid, CancellationToken)

指定用于数据库操作的现有 DbTransaction

public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction> UseTransactionAsync (System.Data.Common.DbTransaction transaction, Guid transactionId, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction?> UseTransactionAsync (System.Data.Common.DbTransaction? transaction, Guid transactionId, System.Threading.CancellationToken cancellationToken = default);
abstract member UseTransactionAsync : System.Data.Common.DbTransaction * Guid * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction>
override this.UseTransactionAsync : System.Data.Common.DbTransaction * Guid * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction>
Public Overridable Function UseTransactionAsync (transaction As DbTransaction, transactionId As Guid, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IDbContextTransaction)

参数

transaction
DbTransaction

要使用的事务。

transactionId
Guid

事务的唯一标识符。

cancellationToken
CancellationToken

等待 CancellationToken 任务完成时要观察的 。

返回

包装所提供的事务的 实例 IDbTransaction

实现

例外

适用于

UseTransactionAsync(DbTransaction, CancellationToken)

指定用于数据库操作的现有 DbTransaction

public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction> UseTransactionAsync (System.Data.Common.DbTransaction transaction, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction?> UseTransactionAsync (System.Data.Common.DbTransaction? transaction, System.Threading.CancellationToken cancellationToken = default);
abstract member UseTransactionAsync : System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction>
override this.UseTransactionAsync : System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction>
Public Overridable Function UseTransactionAsync (transaction As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IDbContextTransaction)

参数

transaction
DbTransaction

要使用的事务。

cancellationToken
CancellationToken

等待 CancellationToken 任务完成时要观察的 。

返回

包装所提供的事务的 实例 IDbTransaction

实现

例外

适用于