Table of Contents

Class QueryCustomizer<T>

Namespace
adas_core.Domain
Assembly
adas-core.Domain.dll

Allow to pass to a IQueryable multiple requests like:

  • Include (to fetch eagerly relations inside T entity) Use a Builder pattern.
var queryCustomizer = QueryCustomizer<Video>.New()
    .Include(v => v.Room)
    .Include(v => v.Clips)
    .Include(v => v.Diagnosis)
    .Include(v => v.Movies)
    .Include(v => v.Patient)
    .Include(v => v.Service)
    .Include(v => v.Thumbnail)
    .Include(v => v.VideoDoctors)
    .Include(v => v.Procedure)
    .Include(v => v.Recordings)
    .Include(v => v.Chapters)
    .Include(v => v.LogDownloadVideoUsers)
    .Include("VideoDoctors.Doctor")
    ;
var v = _videoRepository.GetById(id, queryCustomizer);
public class QueryCustomizer<T> where T : class

Type Parameters

T
Inheritance
QueryCustomizer<T>
Inherited Members
Extension Methods

Methods

AddToQueryable(IQueryable<T>)

Applies a sequence of Include expressions to the specified queryable, enabling eager loading of related entities. Includes are applied in two passes: first using the pre-built LINQ expressions, then using the string-based include expressions.

public IQueryable<T> AddToQueryable(IQueryable<T> queryable)

Parameters

queryable IQueryable<T>

The source queryable to which the include expressions will be applied.

Returns

IQueryable<T>

An IQueryable<T> with all configured include expressions applied.

Include(Expression<Func<T, object>>)

Adds a related entity to the set of include expressions used by the query, enabling eager loading of the specified navigation property.

public QueryCustomizer<T> Include(Expression<Func<T, object>> includeExpression)

Parameters

includeExpression Expression<Func<T, object>>

A lambda expression selecting the related entity to include in the query results.

Returns

QueryCustomizer<T>

The current QueryCustomizer<T> instance to allow fluent chaining of additional includes or customizations.

Include(params Expression<Func<T, object>>[])

Adds one or more include expressions to the query customizer, enabling eager loading of related entities in the resulting query.

public QueryCustomizer<T> Include(params Expression<Func<T, object>>[] includeExpressions)

Parameters

includeExpressions Expression<Func<T, object>>[]

The expressions specifying the related entities to include in the query.

Returns

QueryCustomizer<T>

The current QueryCustomizer<T> instance to support fluent method chaining.

Include(string)

Adds an include expression to the customizer, typically used to specify related entities to eager-load in the query, and returns the current instance to support fluent chaining.

public QueryCustomizer<T> Include(string includeExpression)

Parameters

includeExpression string

The include expression to be added to the collection of include expressions.

Returns

QueryCustomizer<T>

The current QueryCustomizer<T> instance with the include expression added.

Include(params string[])

Adds the specified include expressions to the query, allowing additional related entities or navigation properties to be loaded alongside the primary result.

public QueryCustomizer<T> Include(params string[] includeExpressions)

Parameters

includeExpressions string[]

The string expressions representing the related entities or paths to include in the query.

Returns

QueryCustomizer<T>

The current QueryCustomizer<T> instance to enable fluent method chaining.

New()

Creates and returns a new instance of the QueryCustomizer<T> class.

public static QueryCustomizer<T> New()

Returns

QueryCustomizer<T>

A new QueryCustomizer<T> instance.