DatabaseFacade.CommitTransactionAsync(CancellationToken) 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.
Applies the outstanding operations in the current transaction to the database.
public virtual System.Threading.Tasks.Task CommitTransactionAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member CommitTransactionAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.CommitTransactionAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function CommitTransactionAsync (Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- cancellationToken
- CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Returns
A Task representing the asynchronous operation.
Exceptions
If the CancellationToken is canceled.
Remarks
Entity Framework Core does not support multiple parallel operations being run on the same DbContext instance. This includes both parallel execution of async queries and any explicit concurrent use from multiple threads. Therefore, always await async calls immediately, or use separate DbContext instances for operations that execute in parallel. See Avoiding DbContext threading issues for more information and examples.
See Transactions in EF Core for more information and examples.