RelationalDatabaseFacadeExtensions.BeginTransactionAsync Method
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.
Asynchronously starts a new transaction with a given IsolationLevel.
public static System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction> BeginTransactionAsync (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, System.Data.IsolationLevel isolationLevel, System.Threading.CancellationToken cancellationToken = default);
static member BeginTransactionAsync : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * System.Data.IsolationLevel * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction>
<Extension()>
Public Function BeginTransactionAsync (databaseFacade As DatabaseFacade, isolationLevel As IsolationLevel, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IDbContextTransaction)
- databaseFacade
- DatabaseFacade
The DatabaseFacade for the context.
- isolationLevel
- IsolationLevel
The IsolationLevel to use.
- cancellationToken
- CancellationToken
A CancellationToken to observe while waiting for the task to complete.
A task that represents the asynchronous transaction initialization. The task result contains a IDbContextTransaction that represents the started transaction.
If the CancellationToken is canceled.
See Transactions in EF Core for more information and examples.
Product | Versions |
---|---|
Entity Framework Core | 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0 |
Entity Framework feedback
Entity Framework is an open source project. Select a link to provide feedback: