Skip to content

Commit 562290a

Browse files
committed
Introduce the async savepoint management methods in the SqlConnection class
1 parent baa386f commit 562290a

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

Orm/Xtensive.Orm/Sql/SqlConnection.cs

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,35 @@ public virtual void MakeSavepoint(string name)
354354
}
355355

356356
/// <summary>
357-
/// Rollbacks current transaction to the specified savepoint.
357+
/// Asynchronously makes the transaction savepoint.
358+
/// </summary>
359+
/// <param name="name">The name of the savepoint.</param>
360+
/// <param name="token">The cancellation token to terminate execution if needed.</param>
361+
public virtual Task MakeSavepointAsync(string name, CancellationToken token = default)
362+
{
363+
MakeSavepoint(name);
364+
return Task.CompletedTask;
365+
}
366+
367+
/// <summary>
368+
/// Rolls back current transaction to the specified savepoint.
358369
/// </summary>
359370
/// <param name="name">The name of the savepoint.</param>
360371
public virtual void RollbackToSavepoint(string name) => throw SqlHelper.NotSupported(ServerFeatures.Savepoints);
361372

362373
/// <summary>
363-
/// Releases the savepoint with the specfied name.
374+
/// Asynchronously rolls back current transaction to the specified savepoint.
375+
/// </summary>
376+
/// <param name="name">The name of the savepoint.</param>
377+
/// <param name="token">The cancellation token to terminate execution if needed.</param>
378+
public virtual Task RollbackToSavepointAsync(string name, CancellationToken token = default)
379+
{
380+
RollbackToSavepoint(name);
381+
return Task.CompletedTask;
382+
}
383+
384+
/// <summary>
385+
/// Releases the savepoint with the specified name.
364386
/// </summary>
365387
/// <param name="name">The name of the savepoint.</param>
366388
public virtual void ReleaseSavepoint(string name)
@@ -370,6 +392,17 @@ public virtual void ReleaseSavepoint(string name)
370392
// default impl. will fail on rollback
371393
}
372394

395+
/// <summary>
396+
/// Asynchronously releases the savepoint with the specified name.
397+
/// </summary>
398+
/// <param name="name">The name of the savepoint.</param>
399+
/// <param name="token">The cancellation token to terminate execution if needed.</param>
400+
public virtual Task ReleaseSavepointAsync(string name, CancellationToken token = default)
401+
{
402+
ReleaseSavepoint(name);
403+
return Task.CompletedTask;
404+
}
405+
373406
/// <inheritdoc/>
374407
public void Dispose()
375408
{

0 commit comments

Comments
 (0)