-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIAsyncTransactionalSession.cs
More file actions
24 lines (22 loc) · 1.26 KB
/
IAsyncTransactionalSession.cs
File metadata and controls
24 lines (22 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Light.SharedCore.DatabaseAccessAbstractions;
/// <summary>
/// Represents an asynchronous session to a database that is able to create individual transactions.
/// The connection to the database can be terminated by calling <see cref="IAsyncDisposable.DisposeAsync" />.
/// Changes can be committed by first creating a transaction using <see cref="BeginTransactionAsync" />
/// and later committing this transaction.
/// PLEASE REMEMBER: when your connection to the database always uses a single transaction, please
/// consider using the <see cref="IAsyncSession" /> interface instead. Avoid nesting of several transactions
/// as the interfaces in this package do not cover trees of transactions.
/// </summary>
public interface IAsyncTransactionalSession : IAsyncReadOnlySession
{
/// <summary>
/// Creates a new transaction. Please ensure not to call this method while another transaction
/// is still active in your current scope (to avoid nesting transactions).
/// </summary>
/// <param name="cancellationToken">The token to cancel this asynchronous operation (optional).</param>
ValueTask<IAsyncTransaction> BeginTransactionAsync(CancellationToken cancellationToken = default);
}