DbTransaction.SaveAsync(String, CancellationToken) Method

Definition

Creates a savepoint in the transaction. This allows all commands that are executed after the savepoint was established to be rolled back, restoring the transaction state to what it was at the time of the savepoint.

public virtual System.Threading.Tasks.Task SaveAsync (string savepointName, System.Threading.CancellationToken cancellationToken = default);
abstract member SaveAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.SaveAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function SaveAsync (savepointName As String, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

savepointName
String

The name of the savepoint to be created.

cancellationToken
CancellationToken

An optional token to cancel the asynchronous operation. The default value is None.

Returns

A Task representing the asynchronous operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Save(String).

Applies to