Table of Contents

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

TEntity

The type of the entity.

TKey

The 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

predicate Expression<Func<TEntity, bool>>

The predicate that every element must satisfy.

options QueryOptions<TEntity>

Optional query shaping, including a scope filter to apply first.

Returns

bool

true when every matching element satisfies the predicate; otherwise false.

AllMatching(ISpecification<TEntity>, QueryOptions<TEntity>?)

Gets all elements matching the supplied specification.

IEnumerable<TEntity> AllMatching(ISpecification<TEntity> specification, QueryOptions<TEntity>? options = null)

Parameters

specification ISpecification<TEntity>

The specification to apply.

options QueryOptions<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

options QueryOptions<TEntity>

Optional query shaping, including the filter to apply.

Returns

bool

true when at least one element matches; otherwise false.

Count(QueryOptions<TEntity>?)

Counts the elements matching the supplied options.

long Count(QueryOptions<TEntity>? options = null)

Parameters

options QueryOptions<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

id TKey

The entity key.

options QueryOptions<TEntity>

Optional query shaping.

Returns

TEntity

The entity, or null when not found.

GetAll(QueryOptions<TEntity>?)

Gets all elements, optionally shaped by options.

IEnumerable<TEntity> GetAll(QueryOptions<TEntity>? options = null)

Parameters

options QueryOptions<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

filter Expression<Func<TEntity, bool>>

The predicate to apply.

options QueryOptions<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

options QueryOptions<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

map Expression<Func<TEntity, TResult>>

The projection to apply.

options QueryOptions<TEntity>

The query shaping, including the filter to apply.

Returns

TResult

The first projected result, or the default when none match.

Type Parameters

TResult

The 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

map Expression<Func<TEntity, TResult>>

The projection to apply.

options QueryOptions<TEntity>

Optional query shaping (filter, sorting, includes, tracking).

Returns

IEnumerable<TResult>

The projected results.

Type Parameters

TResult

The 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

page PageRequest

The page to retrieve.

options QueryOptions<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

page PageRequest

The page to retrieve.

map Expression<Func<TEntity, TResult>>

The projection to apply.

options QueryOptions<TEntity>

Optional query shaping (filter, sorting, includes, tracking).

Returns

PagedResult<TResult>

The requested page of projected results.

Type Parameters

TResult

The 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

options QueryOptions<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

selector Expression<Func<TEntity, decimal>>

A projection function applied to each element.

options QueryOptions<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

selector Expression<Func<TEntity, double>>

A projection function applied to each element.

options QueryOptions<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

selector Expression<Func<TEntity, int>>

A projection function applied to each element.

options QueryOptions<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

selector Expression<Func<TEntity, long>>

A projection function applied to each element.

options QueryOptions<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

selector Expression<Func<TEntity, decimal?>>

A projection function applied to each element.

options QueryOptions<TEntity>

Optional query shaping, including the filter to apply.

Returns

decimal?

The sum of the projected values, or null when 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

selector Expression<Func<TEntity, double?>>

A projection function applied to each element.

options QueryOptions<TEntity>

Optional query shaping, including the filter to apply.

Returns

double?

The sum of the projected values, or null when 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

selector Expression<Func<TEntity, int?>>

A projection function applied to each element.

options QueryOptions<TEntity>

Optional query shaping, including the filter to apply.

Returns

int?

The sum of the projected values, or null when 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

selector Expression<Func<TEntity, long?>>

A projection function applied to each element.

options QueryOptions<TEntity>

Optional query shaping, including the filter to apply.

Returns

long?

The sum of the projected values, or null when 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

selector Expression<Func<TEntity, float?>>

A projection function applied to each element.

options QueryOptions<TEntity>

Optional query shaping, including the filter to apply.

Returns

float?

The sum of the projected values, or null when 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

selector Expression<Func<TEntity, float>>

A projection function applied to each element.

options QueryOptions<TEntity>

Optional query shaping, including the filter to apply.

Returns

float

The sum of the projected values.

See Also