galaeth-draft/Galaeth.Core/Infrastructure/ITransactionProvider.cs
2024-11-17 09:31:01 +00:00

25 lines
840 B
C#

using System.Data;
using System.Data.Common;
namespace Galaeth.Core.Infrastructure;
/// <summary>
/// Database transaction provider.
/// </summary>
public interface ITransactionProvider
{
/// <summary>
/// Begin a new transaction.
/// </summary>
/// <param name="isolationLevel">One of <see cref="IsolationLevel"/>.</param>
/// <returns>Instance of <see cref="IDbTransaction"/>.</returns>
IDbTransaction BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.Unspecified);
/// <summary>
/// Begin a new transaction.
/// </summary>
/// <param name="isolationLevel">One of <see cref="IsolationLevel"/>.</param>
/// <returns>Instance of <see cref="IDbTransaction"/>.</returns>
Task<IDbTransaction> BeginTransactionAsync(IsolationLevel isolationLevel = IsolationLevel.Unspecified);
}