RelationalDatabaseFacadeExtensions.UseTransactionAsync 方法

定义

重载

UseTransactionAsync(DatabaseFacade, DbTransaction, CancellationToken)

DbTransaction设置 要由 上的DbContext数据库操作使用的 。

UseTransactionAsync(DatabaseFacade, DbTransaction, Guid, CancellationToken)

DbTransaction设置 要由 上的DbContext数据库操作使用的 。

UseTransactionAsync(DatabaseFacade, DbTransaction, CancellationToken)

DbTransaction设置 要由 上的DbContext数据库操作使用的 。

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

参数

databaseFacade
DatabaseFacade

DatabaseFacade上下文的 。

transaction
DbTransaction

要使用的 DbTransaction

cancellationToken
CancellationToken

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

返回

包含TaskIDbContextTransaction给定事务的 。

例外

注解

有关详细信息和示例,请参阅 EF Core 中的事务

适用于

UseTransactionAsync(DatabaseFacade, DbTransaction, Guid, CancellationToken)

DbTransaction设置 要由 上的DbContext数据库操作使用的 。

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

参数

databaseFacade
DatabaseFacade

DatabaseFacade上下文的 。

transaction
DbTransaction

要使用的 DbTransaction

transactionId
Guid

事务的唯一标识符。

cancellationToken
CancellationToken

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

返回

包含TaskIDbContextTransaction给定事务的 。

例外

注解

有关详细信息和示例,请参阅 EF Core 中的事务

适用于