RelationalConnection.UseTransactionAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
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 。