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

26 lines
755 B
C#
Raw Normal View History

2024-12-11 21:36:30 +01:00
// <copyright file="IDbConnectionProvider.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>
/// Scoped database connection provider.
/// </summary>
public interface IDbConnectionProvider : IDisposable
{
/// <summary>
/// Open new database connection for this scope.
/// </summary>
/// <returns>Instance of <see cref="IDbConnection" />.</returns>
IDbConnection OpenConnection();
/// <summary>
/// Open new database connection for this scope.
/// </summary>
/// <returns>Instance of <see cref="IDbConnection" />.</returns>
Task<IDbConnection> OpenConnectionAsync();
}