astral-api/Astral.Core/Infrastructure/ITransactionProvider.cs

28 lines
983 B
C#
Raw Normal View History

2024-12-11 21:36:30 +01:00
// <copyright file="ITransactionProvider.cs" company="alveus.dev">
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
// </copyright>
using System.Data;
namespace Astral.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);
}