FruityFoundation/FruityFoundation.DataAccess.Abstractions/IDatabaseConnection.cs
2024-09-05 23:03:43 -04:00

17 lines
1.1 KiB
C#

using System.Data.Common;
using FruityFoundation.Base.Structures;
namespace FruityFoundation.DataAccess.Abstractions;
// ReSharper disable once UnusedTypeParameter
public interface IDatabaseConnection<out TConnectionType> where TConnectionType : ConnectionType
{
public Task<IEnumerable<T>> Query<T>(string sql, object? param = null, CancellationToken cancellationToken = default);
public IAsyncEnumerable<T> QueryUnbuffered<T>(string sql, object? param = null, CancellationToken cancellationToken = default);
public Task<T> QuerySingle<T>(string sql, object? param = null, CancellationToken cancellationToken = default);
public Task<Maybe<T>> TryQueryFirst<T>(string sql, object? param = null, CancellationToken cancellationToken = default);
public Task Execute(string sql, object? param = null, CancellationToken cancellationToken = default);
public Task<T?> ExecuteScalar<T>(string sql, object? param = null, CancellationToken cancellationToken = default);
public Task<DbDataReader> ExecuteReader(string sql, object? param = null, CancellationToken cancellationToken = default);
}