RelationalConnection.UseTransactionAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
UseTransactionAsync(DbTransaction, Guid, CancellationToken) |
Specifies an existing DbTransaction to be used for database operations. |
UseTransactionAsync(DbTransaction, CancellationToken) |
Specifies an existing DbTransaction to be used for database operations. |
UseTransactionAsync(DbTransaction, Guid, CancellationToken)
Specifies an existing DbTransaction to be used for database operations.
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)
Parameters
- transaction
- DbTransaction
The transaction to be used.
- transactionId
- Guid
The unique identifier for the transaction.
- cancellationToken
- CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Returns
An instance of IDbTransaction that wraps the provided transaction.
Implements
Exceptions
If the CancellationToken is canceled.
Applies to
UseTransactionAsync(DbTransaction, CancellationToken)
Specifies an existing DbTransaction to be used for database operations.
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)
Parameters
- transaction
- DbTransaction
The transaction to be used.
- cancellationToken
- CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Returns
An instance of IDbTransaction that wraps the provided transaction.
Implements
Exceptions
If the CancellationToken is canceled.
Applies to
Entity Framework