Interface IReadRepository<TEntity, TKey>
- Namespace
- eQuantic.Core.Data.Repository.Read
- Assembly
- eQuantic.Core.Data.dll
The synchronous read repository. It mirrors IAsyncReadRepository<TEntity, TKey> and shapes queries through a single QueryOptions<TEntity> argument.
public interface IReadRepository<TEntity, TKey> : IRepository, IDisposable where TEntity : class, IEntity<TKey>
Type Parameters
TEntityThe type of the entity.
TKeyThe type of the key.
- Inherited Members
Methods
All(Expression<Func<TEntity, bool>>, QueryOptions<TEntity>?)
Determines whether all elements matching the supplied options satisfy the predicate.
bool All(Expression<Func<TEntity, bool>> predicate, QueryOptions<TEntity>? options = null)
Parameters
predicateExpression<Func<TEntity, bool>>The predicate that every element must satisfy.
optionsQueryOptions<TEntity>Optional query shaping, including a scope filter to apply first.
Returns
- bool
truewhen every matching element satisfies the predicate; otherwisefalse.
AllMatching(ISpecification<TEntity>, QueryOptions<TEntity>?)
Gets all elements matching the supplied specification.
IEnumerable<TEntity> AllMatching(ISpecification<TEntity> specification, QueryOptions<TEntity>? options = null)
Parameters
specificationISpecification<TEntity>The specification to apply.
optionsQueryOptions<TEntity>Optional additional query shaping.
Returns
- IEnumerable<TEntity>
The matching entities.
Any(QueryOptions<TEntity>?)
Determines whether any element matches the supplied options.
bool Any(QueryOptions<TEntity>? options = null)
Parameters
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- bool
truewhen at least one element matches; otherwisefalse.
Count(QueryOptions<TEntity>?)
Counts the elements matching the supplied options.
long Count(QueryOptions<TEntity>? options = null)
Parameters
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- long
The number of matching elements.
Get(TKey, QueryOptions<TEntity>?)
Gets the element identified by its key.
TEntity? Get(TKey id, QueryOptions<TEntity>? options = null)
Parameters
idTKeyThe entity key.
optionsQueryOptions<TEntity>Optional query shaping.
Returns
- TEntity
The entity, or
nullwhen not found.
GetAll(QueryOptions<TEntity>?)
Gets all elements, optionally shaped by options.
IEnumerable<TEntity> GetAll(QueryOptions<TEntity>? options = null)
Parameters
optionsQueryOptions<TEntity>Optional query shaping (filter, sorting, includes, tracking).
Returns
- IEnumerable<TEntity>
The matching entities.
GetFiltered(Expression<Func<TEntity, bool>>, QueryOptions<TEntity>?)
Gets all elements matching the supplied predicate.
IEnumerable<TEntity> GetFiltered(Expression<Func<TEntity, bool>> filter, QueryOptions<TEntity>? options = null)
Parameters
filterExpression<Func<TEntity, bool>>The predicate to apply.
optionsQueryOptions<TEntity>Optional additional query shaping.
Returns
- IEnumerable<TEntity>
The matching entities.
GetFirst(QueryOptions<TEntity>)
Gets the first element matching the supplied options, or null when none match.
TEntity? GetFirst(QueryOptions<TEntity> options)
Parameters
optionsQueryOptions<TEntity>The query shaping, including the filter to apply.
Returns
- TEntity
The first matching entity, or
null.
GetFirstMapped<TResult>(Expression<Func<TEntity, TResult>>, QueryOptions<TEntity>)
Gets the first element matching the supplied options, projected to TResult.
TResult? GetFirstMapped<TResult>(Expression<Func<TEntity, TResult>> map, QueryOptions<TEntity> options)
Parameters
mapExpression<Func<TEntity, TResult>>The projection to apply.
optionsQueryOptions<TEntity>The query shaping, including the filter to apply.
Returns
- TResult
The first projected result, or the default when none match.
Type Parameters
TResultThe projection result type.
GetMapped<TResult>(Expression<Func<TEntity, TResult>>, QueryOptions<TEntity>?)
Gets all elements projected to TResult.
IEnumerable<TResult> GetMapped<TResult>(Expression<Func<TEntity, TResult>> map, QueryOptions<TEntity>? options = null)
Parameters
mapExpression<Func<TEntity, TResult>>The projection to apply.
optionsQueryOptions<TEntity>Optional query shaping (filter, sorting, includes, tracking).
Returns
- IEnumerable<TResult>
The projected results.
Type Parameters
TResultThe projection result type.
GetPaged(PageRequest, QueryOptions<TEntity>?)
Gets a page of elements together with the total number of matching items.
PagedResult<TEntity> GetPaged(PageRequest page, QueryOptions<TEntity>? options = null)
Parameters
pagePageRequestThe page to retrieve.
optionsQueryOptions<TEntity>Optional query shaping (filter, sorting, includes, tracking).
Returns
- PagedResult<TEntity>
The requested page of entities.
GetPaged<TResult>(PageRequest, Expression<Func<TEntity, TResult>>, QueryOptions<TEntity>?)
Gets a page of elements projected to TResult together
with the total number of matching items.
PagedResult<TResult> GetPaged<TResult>(PageRequest page, Expression<Func<TEntity, TResult>> map, QueryOptions<TEntity>? options = null)
Parameters
pagePageRequestThe page to retrieve.
mapExpression<Func<TEntity, TResult>>The projection to apply.
optionsQueryOptions<TEntity>Optional query shaping (filter, sorting, includes, tracking).
Returns
- PagedResult<TResult>
The requested page of projected results.
Type Parameters
TResultThe projection result type.
GetSingle(QueryOptions<TEntity>)
Gets the single element matching the supplied options, or null when none match.
TEntity? GetSingle(QueryOptions<TEntity> options)
Parameters
optionsQueryOptions<TEntity>The query shaping, including the filter to apply.
Returns
- TEntity
The single matching entity, or
null.
Sum(Expression<Func<TEntity, decimal>>, QueryOptions<TEntity>?)
Computes the sum of a projected decimal value over the matching elements.
decimal Sum(Expression<Func<TEntity, decimal>> selector, QueryOptions<TEntity>? options = null)
Parameters
selectorExpression<Func<TEntity, decimal>>A projection function applied to each element.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- decimal
The sum of the projected values.
Sum(Expression<Func<TEntity, double>>, QueryOptions<TEntity>?)
Computes the sum of a projected double value over the matching elements.
double Sum(Expression<Func<TEntity, double>> selector, QueryOptions<TEntity>? options = null)
Parameters
selectorExpression<Func<TEntity, double>>A projection function applied to each element.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- double
The sum of the projected values.
Sum(Expression<Func<TEntity, int>>, QueryOptions<TEntity>?)
Computes the sum of a projected int value over the matching elements.
int Sum(Expression<Func<TEntity, int>> selector, QueryOptions<TEntity>? options = null)
Parameters
selectorExpression<Func<TEntity, int>>A projection function applied to each element.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- int
The sum of the projected values.
Sum(Expression<Func<TEntity, long>>, QueryOptions<TEntity>?)
Computes the sum of a projected long value over the matching elements.
long Sum(Expression<Func<TEntity, long>> selector, QueryOptions<TEntity>? options = null)
Parameters
selectorExpression<Func<TEntity, long>>A projection function applied to each element.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- long
The sum of the projected values.
Sum(Expression<Func<TEntity, decimal?>>, QueryOptions<TEntity>?)
Computes the sum of a projected nullable decimal value over the matching elements.
decimal? Sum(Expression<Func<TEntity, decimal?>> selector, QueryOptions<TEntity>? options = null)
Parameters
selectorExpression<Func<TEntity, decimal?>>A projection function applied to each element.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- decimal?
The sum of the projected values, or
nullwhen the sequence is empty.
Sum(Expression<Func<TEntity, double?>>, QueryOptions<TEntity>?)
Computes the sum of a projected nullable double value over the matching elements.
double? Sum(Expression<Func<TEntity, double?>> selector, QueryOptions<TEntity>? options = null)
Parameters
selectorExpression<Func<TEntity, double?>>A projection function applied to each element.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- double?
The sum of the projected values, or
nullwhen the sequence is empty.
Sum(Expression<Func<TEntity, int?>>, QueryOptions<TEntity>?)
Computes the sum of a projected nullable int value over the matching elements.
int? Sum(Expression<Func<TEntity, int?>> selector, QueryOptions<TEntity>? options = null)
Parameters
selectorExpression<Func<TEntity, int?>>A projection function applied to each element.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- int?
The sum of the projected values, or
nullwhen the sequence is empty.
Sum(Expression<Func<TEntity, long?>>, QueryOptions<TEntity>?)
Computes the sum of a projected nullable long value over the matching elements.
long? Sum(Expression<Func<TEntity, long?>> selector, QueryOptions<TEntity>? options = null)
Parameters
selectorExpression<Func<TEntity, long?>>A projection function applied to each element.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- long?
The sum of the projected values, or
nullwhen the sequence is empty.
Sum(Expression<Func<TEntity, float?>>, QueryOptions<TEntity>?)
Computes the sum of a projected nullable float value over the matching elements.
float? Sum(Expression<Func<TEntity, float?>> selector, QueryOptions<TEntity>? options = null)
Parameters
selectorExpression<Func<TEntity, float?>>A projection function applied to each element.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- float?
The sum of the projected values, or
nullwhen the sequence is empty.
Sum(Expression<Func<TEntity, float>>, QueryOptions<TEntity>?)
Computes the sum of a projected float value over the matching elements.
float Sum(Expression<Func<TEntity, float>> selector, QueryOptions<TEntity>? options = null)
Parameters
selectorExpression<Func<TEntity, float>>A projection function applied to each element.
optionsQueryOptions<TEntity>Optional query shaping, including the filter to apply.
Returns
- float
The sum of the projected values.