astral-api/Astral.Core/Infrastructure/ITransactionProvider.cs
2024-12-11 20:36:30 +00:00

27 lines
983 B
C#

// <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);
}