Table of Contents

Class QueryBuilder

Namespace
Breeze.Core
Assembly
Breeze.Core.dll

Used to build up a Queryable.

public class QueryBuilder
Inheritance
QueryBuilder
Inherited Members

Methods

ApplyOrderBy(IQueryable, Type, OrderByClause)

Apply an orderBy clause, using OrderBy for the first term and ThenBy for the rest.

public static IQueryable ApplyOrderBy(IQueryable source, Type elementType, OrderByClause orderByClause)

Parameters

source IQueryable

The queryable to sort.

elementType Type

The element type of the queryable.

orderByClause OrderByClause

The validated orderBy clause.

Returns

IQueryable

The sorted queryable.

Exceptions

Exception

A sort path does not resolve to a property.

ApplySelect(IQueryable, Type, SelectClause)

Apply a select clause, projecting onto a type generated to hold exactly the selected properties.

public static IQueryable ApplySelect(IQueryable source, Type elementType, SelectClause selectClause)

Parameters

source IQueryable

The queryable to project.

elementType Type

The element type of the queryable.

selectClause SelectClause

The validated select clause.

Returns

IQueryable

A queryable over the generated projection type.

ApplySkip(IQueryable, Type, int)

Apply Queryable.Skip for the element type.

public static IQueryable ApplySkip(IQueryable source, Type elementType, int skipCount)

Parameters

source IQueryable

The queryable to skip within.

elementType Type

The element type of the queryable.

skipCount int

The number of rows to skip.

Returns

IQueryable

The queryable with Skip applied.

ApplyTake(IQueryable, Type, int)

Apply Queryable.Take for the element type.

public static IQueryable ApplyTake(IQueryable source, Type elementType, int takeCount)

Parameters

source IQueryable

The queryable to limit.

elementType Type

The element type of the queryable.

takeCount int

The number of rows to take.

Returns

IQueryable

The queryable with Take applied.

ApplyWhere(IQueryable, Type, BasePredicate)

Apply a where clause by building the Queryable.Where call for the element type.

public static IQueryable ApplyWhere(IQueryable source, Type elementType, BasePredicate predicate)

Parameters

source IQueryable

The queryable to filter.

elementType Type

The element type of the queryable.

predicate BasePredicate

The validated where clause.

Returns

IQueryable

The filtered queryable.

BuildIQueryableFunc(Type, MethodInfo)

Compile a delegate that calls a one-argument Queryable method on an untyped IQueryable.

public static Func<IQueryable, IQueryable> BuildIQueryableFunc(Type instanceType, MethodInfo method)

Parameters

instanceType Type

The element type to close the method over.

method MethodInfo

The Queryable method to call.

Returns

Func<IQueryable, IQueryable>

A delegate applying that method.

Remarks

The Queryable methods are generic, but the element type is only known at runtime, so the call is built as an expression - casting in to IQueryable<T> and back out again - and compiled.

BuildIQueryableFunc<TArg>(Type, MethodInfo, TArg, Type?)

Compile a delegate that calls a two-argument Queryable method on an untyped IQueryable, with the second argument fixed.

public static Func<IQueryable, IQueryable> BuildIQueryableFunc<TArg>(Type instanceType, MethodInfo method, TArg parameter, Type? queryableBaseType = null)

Parameters

instanceType Type

The element type to close the method over.

method MethodInfo

The Queryable method to call.

parameter TArg

The value passed as the method's second argument.

queryableBaseType Type

The interface to cast the source to; defaults to IQueryable<T>, and is IOrderedQueryable<T> for ThenBy.

Returns

Func<IQueryable, IQueryable>

A delegate applying that method.

Type Parameters

TArg

The type of the fixed argument - a lambda for Where and OrderBy, an int for Skip and Take.