Interface IAggregateReadRepository<TEntity>
- Namespace
- eQuantic.Core.Data.Repository.Read
- Assembly
- eQuantic.Core.Data.dll
A read repository that computes MIN/MAX/AVG on the store (with a client-side fallback
for computed selectors), completing the aggregate surface next to the contract's Count/Sum.
Providers opt in.
public interface IAggregateReadRepository<TEntity> where TEntity : class
Type Parameters
TEntityThe entity type.
Methods
AverageAsync<TValue>(Expression<Func<TEntity, TValue>>, QueryOptions<TEntity>?, CancellationToken)
The average of the projected numeric value over the matching elements as a double
(integer columns are cast before averaging, so nothing truncates), or 0 when none match.
Task<double> AverageAsync<TValue>(Expression<Func<TEntity, TValue>> selector, QueryOptions<TEntity>? options = null, CancellationToken cancellationToken = default)
Parameters
selectorExpression<Func<TEntity, TValue>>The projection.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
cancellationTokenCancellationTokenThe cancellation token.
Returns
Type Parameters
TValueThe projected numeric type.
MaxAsync<TResult>(Expression<Func<TEntity, TResult>>, QueryOptions<TEntity>?, CancellationToken)
The maximum of the projected value over the matching elements, or default when none match.
Task<TResult?> MaxAsync<TResult>(Expression<Func<TEntity, TResult>> selector, QueryOptions<TEntity>? options = null, CancellationToken cancellationToken = default)
Parameters
selectorExpression<Func<TEntity, TResult>>The projection.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<TResult>
Type Parameters
TResultThe projected type.
MinAsync<TResult>(Expression<Func<TEntity, TResult>>, QueryOptions<TEntity>?, CancellationToken)
The minimum of the projected value over the matching elements, or default when none match.
Task<TResult?> MinAsync<TResult>(Expression<Func<TEntity, TResult>> selector, QueryOptions<TEntity>? options = null, CancellationToken cancellationToken = default)
Parameters
selectorExpression<Func<TEntity, TResult>>The projection.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<TResult>
Type Parameters
TResultThe projected type.