Share via


DatabaseFacade.RollbackTransactionAsync(CancellationToken) Method

Definition

Discards the outstanding operations in the current transaction.

public virtual System.Threading.Tasks.Task RollbackTransactionAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member RollbackTransactionAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.RollbackTransactionAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function RollbackTransactionAsync (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

Remarks

See Transactions in EF Core for more information and examples.

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.

Applies to