Table of Contents

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

TEntity

The 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

selector Expression<Func<TEntity, TValue>>

The projection.

options QueryOptions<TEntity>

Optional query shaping, including the filter to apply.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<double>

Type Parameters

TValue

The 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

selector Expression<Func<TEntity, TResult>>

The projection.

options QueryOptions<TEntity>

Optional query shaping, including the filter to apply.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<TResult>

Type Parameters

TResult

The 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

selector Expression<Func<TEntity, TResult>>

The projection.

options QueryOptions<TEntity>

Optional query shaping, including the filter to apply.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<TResult>

Type Parameters

TResult

The projected type.