Class QueryableExtensions
- Namespace
- Cratis.Arc.Queries
- Assembly
- Cratis.Arc.Core.dll
Provides a set of methods for working with IQueryable.
public static class QueryableExtensions
- Inheritance
-
QueryableExtensions
- Inherited Members
Remarks
The element type of a non-generic IQueryable is only known at runtime. Each operation is therefore performed by a generic method closed over the element type, which calls the typed Queryable operator directly. The generic methods are looked up by name on this type, so the trimmer can see which methods are needed.
Methods
Count(IQueryable)
Returns the number of elements in a sequence.
public static int Count(this IQueryable queryable)
Parameters
queryableIQueryableThe IQueryable to adorn.
Returns
- int
The number of elements in the input sequence.
OrderBy(IQueryable, string, SortDirection)
Sorts the elements of a sequence in ascending or descending order according to a key.
public static IQueryable OrderBy(this IQueryable queryable, string field, SortDirection direction = SortDirection.Ascending)
Parameters
queryableIQueryableThe IQueryable to adorn.
fieldstringThe name of the field to order on.
directionSortDirectionOptional direction of sort. Defaults to ascending.
Returns
- IQueryable
An IQueryable for continuation.
OrderByDescending(IQueryable, string)
Sorts the elements of a sequence in descending order according to a key.
public static IQueryable OrderByDescending(this IQueryable queryable, string field)
Parameters
queryableIQueryableThe IQueryable to adorn.
fieldstringThe name of the field to order on.
Returns
- IQueryable
An IQueryable for continuation.
Skip(IQueryable, int)
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
public static IQueryable Skip(this IQueryable queryable, int count)
Parameters
queryableIQueryableAn IQueryable to adorn.
countintThe number of elements to skip before returning the remaining elements.
Returns
- IQueryable
An IQueryable for continuation.
Take(IQueryable, int)
Returns a specified number of contiguous elements from the start of a sequence.
public static IQueryable Take(this IQueryable queryable, int count)
Parameters
queryableIQueryableThe IQueryable to adorn.
countintThe number of elements to return.
Returns
- IQueryable
An IQueryable for continuation.