Class EntityQueryExtensions
Applies the clauses of an EntityQuery to an IQueryable, one clause at a time.
public static class EntityQueryExtensions
- Inheritance
-
EntityQueryExtensions
- Inherited Members
Remarks
Order matters: where first, then orderBy, skip and take, then select, and expand last. Each method is a no-op when the query has no such clause.
Methods
ApplyExpand(EntityQuery, IQueryable, Type)
Apply the query's expand clause by calling Include for each path.
public static IQueryable ApplyExpand(this EntityQuery eq, IQueryable queryable, Type eleType)
Parameters
eqEntityQueryThe query.
queryableIQueryableThe queryable to add Includes to.
eleTypeTypeThe element type of the queryable.
Returns
- IQueryable
The queryable, unchanged if there is no expand clause.
Remarks
Include is resolved dynamically, so this works against any provider that offers one.
ApplyOrderBy(EntityQuery, IQueryable, Type)
Apply the query's orderBy clause, if it has one.
public static IQueryable ApplyOrderBy(this EntityQuery eq, IQueryable queryable, Type eleType)
Parameters
eqEntityQueryThe query. It must already have been validated.
queryableIQueryableThe queryable to sort.
eleTypeTypeThe element type of the queryable.
Returns
- IQueryable
The sorted queryable, or the original if there is no orderBy clause.
ApplySelect(EntityQuery, IQueryable, Type)
Apply the query's select clause, if it has one, projecting onto a generated type.
public static IQueryable ApplySelect(this EntityQuery eq, IQueryable queryable, Type eleType)
Parameters
eqEntityQueryThe query. It must already have been validated.
queryableIQueryableThe queryable to project.
eleTypeTypeThe element type of the queryable.
Returns
- IQueryable
The projected queryable, or the original if there is no select clause.
ApplySkip(EntityQuery, IQueryable, Type)
Apply the query's skip count, if it has one.
public static IQueryable ApplySkip(this EntityQuery eq, IQueryable queryable, Type eleType)
Parameters
eqEntityQueryThe query.
queryableIQueryableThe queryable to skip within.
eleTypeTypeThe element type of the queryable.
Returns
- IQueryable
The queryable, unchanged if no skip was requested.
ApplyTake(EntityQuery, IQueryable, Type)
Apply the query's take count, if it has one.
public static IQueryable ApplyTake(this EntityQuery eq, IQueryable queryable, Type eleType)
Parameters
eqEntityQueryThe query.
queryableIQueryableThe queryable to limit.
eleTypeTypeThe element type of the queryable.
Returns
- IQueryable
The queryable, unchanged if no take was requested.
ApplyWhere(EntityQuery, IQueryable, Type)
Apply the query's where clause, if it has one.
public static IQueryable ApplyWhere(this EntityQuery eq, IQueryable queryable, Type eleType)
Parameters
eqEntityQueryThe query. It must already have been validated.
queryableIQueryableThe queryable to filter.
eleTypeTypeThe element type of the queryable.
Returns
- IQueryable
The filtered queryable, or the original if there is no where clause.
GetTakeValue(IQueryable)
Gets the minimum Take() value in the queryable Expression
public static int? GetTakeValue(IQueryable queryable)
Parameters
queryableIQueryable
Returns
- int?