29 lines
1.7 KiB
C#
29 lines
1.7 KiB
C#
using Dapper;
|
|
|
|
namespace EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public interface ISQLExecutor
|
|
{
|
|
/// <summary>
|
|
/// Executes a raw SQL query and returns an <see cref="IQuery{TEntity}"/> for further querying operations on the result.
|
|
/// </summary>
|
|
/// <typeparam name="TEntity">The entity type to which the SQL query results will be mapped.</typeparam>
|
|
/// <param name="sql">The raw SQL query to execute.</param>
|
|
/// <param name="parameters">Parameters for the SQL query.</param>
|
|
/// <param name="cancellation">Optional cancellation token for the operation.</param>
|
|
/// <returns>An <see cref="IQuery{TEntity}"/> instance for further query operations on the result.</returns>
|
|
Task<IEnumerable<TEntity>> Execute<TEntity>(string sql, DynamicParameters parameters, CancellationToken cancellation = default);
|
|
|
|
/// <summary>
|
|
/// Executes a custom SQL query defined by a class that implements <see cref="ISQL{TEntity}"/> and returns an <see cref="IQuery{TEntity}"/> for further querying operations on the result.
|
|
/// </summary>
|
|
/// <typeparam name="TEntity">The entity type to which the SQL query results will be mapped.</typeparam>
|
|
/// <typeparam name="TSQL">The type of the custom SQL query class implementing <see cref="ISQL{TEntity}"/>.</typeparam>
|
|
/// <param name="parameters">Parameters for the SQL query.</param>
|
|
/// <param name="cancellation">Optional cancellation token for the operation.</param>
|
|
/// <returns>An <see cref="IQuery{TEntity}"/> instance for further query operations on the result.</returns>
|
|
Task<IEnumerable<TEntity>> Execute<TEntity, TSQL>(DynamicParameters parameters, CancellationToken cancellation = default) where TSQL : ISQL;
|
|
} |