RelationalDatabaseFacadeExtensions.UseTransactionAsync 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
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 工作完成時要觀察的 。
傳回
, Task 包含 IDbContextTransaction 指定交易的 。
例外狀況
備註
如需詳細資訊和範例,請參閱 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 工作完成時要觀察的 。
傳回
, Task 包含 IDbContextTransaction 指定交易的 。
例外狀況
備註
如需詳細資訊和範例,請參閱 EF Core 中的交易 。