Show / Hide Table of Contents

Class QueryableHelper

Extension methods for System.Linq.IQueryable<T>.

Inheritance
System.Object
QueryableHelper
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Data.Linq
Assembly: Kephas.Data.dll
Syntax
public static class QueryableHelper

Methods

| Improve this Doc View Source

AnyAsync(IQueryable, CancellationToken)

Determines asynchronously whether a sequence contains any elements.

Declaration
public static Task<bool> AnyAsync(this IQueryable query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

A promise of a boolean value indicating whether a sequence contains any elements.

| Improve this Doc View Source

AnyAsync<T>(IQueryable<T>, CancellationToken)

Determines asynchronously whether a sequence contains any elements.

Declaration
public static Task<bool> AnyAsync<T>(this IQueryable<T> query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

A promise of a boolean value indicating whether a sequence contains any elements.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

CountAsync(IQueryable, CancellationToken)

Returns the number of elements in a sequence.

Declaration
public static Task<int> CountAsync(this IQueryable query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Int32>

A promise of the number of elements in a sequence.

| Improve this Doc View Source

CountAsync<T>(IQueryable<T>, CancellationToken)

Returns the number of elements in a sequence.

Declaration
public static Task<int> CountAsync<T>(this IQueryable<T> query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Int32>

A promise of the number of elements in a sequence.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

FirstAsync(IQueryable, CancellationToken)

Returns the first element of a sequence.

Declaration
public static Task<object> FirstAsync(this IQueryable query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Object>

A promise of the first element of a sequence.

| Improve this Doc View Source

FirstAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken)

Returns the first element of a sequence that satisfies a specified condition.

Declaration
public static Task<T> FirstAsync<T>(this IQueryable<T> query, Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Linq.Expressions.Expression<System.Func<T, System.Boolean>> predicate

The condition to be satisfied.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the first element of a sequence.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

FirstAsync<T>(IQueryable<T>, CancellationToken)

Returns the first element of a sequence.

Declaration
public static Task<T> FirstAsync<T>(this IQueryable<T> query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the first element of a sequence.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

FirstOrDefaultAsync(IQueryable, CancellationToken)

Returns the first element of a sequence, or a default value, if the sequence contains no elements.

Declaration
public static Task<object> FirstOrDefaultAsync(this IQueryable query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Object>

A promise of the first element of a sequence.

| Improve this Doc View Source

FirstOrDefaultAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken)

Returns the first element of a sequence that satisfies a specified condition, or a default value, if no such element is found.

Declaration
public static Task<T> FirstOrDefaultAsync<T>(this IQueryable<T> query, Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Linq.Expressions.Expression<System.Func<T, System.Boolean>> predicate

The condition to be satisfied.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the first element of a sequence.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

FirstOrDefaultAsync<T>(IQueryable<T>, CancellationToken)

Returns the first element of a sequence, or a default value, if the sequence contains no elements.

Declaration
public static Task<T> FirstOrDefaultAsync<T>(this IQueryable<T> query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the first element of a sequence.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

LongCountAsync(IQueryable, CancellationToken)

Returns a long that represents the number of elements in a sequence.

Declaration
public static Task<long> LongCountAsync(this IQueryable query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Int64>

A promise of a long that represents the number of elements in a sequence.

| Improve this Doc View Source

LongCountAsync<T>(IQueryable<T>, CancellationToken)

Returns a long that represents the number of elements in a sequence.

Declaration
public static Task<long> LongCountAsync<T>(this IQueryable<T> query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Int64>

A promise of a long that represents the number of elements in a sequence.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

SingleAsync(IQueryable, CancellationToken)

Returns the single element of a sequence.

Declaration
public static Task<object> SingleAsync(this IQueryable query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Object>

A promise of the single element of a sequence.

| Improve this Doc View Source

SingleAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken)

Returns the single element of a sequence that satisfies a specified condition.

Declaration
public static Task<T> SingleAsync<T>(this IQueryable<T> query, Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Linq.Expressions.Expression<System.Func<T, System.Boolean>> predicate

The condition to be satisfied.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the single element of a sequence.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

SingleAsync<T>(IQueryable<T>, CancellationToken)

Returns the single element of a sequence.

Declaration
public static Task<T> SingleAsync<T>(this IQueryable<T> query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the single element of a sequence.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

SingleOrDefaultAsync(IQueryable, CancellationToken)

Returns the single element of a sequence, or a default value, if the sequence contains no elements.

Declaration
public static Task<object> SingleOrDefaultAsync(this IQueryable query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Object>

A promise of the single element of a sequence.

| Improve this Doc View Source

SingleOrDefaultAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken)

Returns the single element of a sequence that satisfies a specified condition, or a default value, if no such element is found.

Declaration
public static Task<T> SingleOrDefaultAsync<T>(this IQueryable<T> query, Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Linq.Expressions.Expression<System.Func<T, System.Boolean>> predicate

The condition to be satisfied.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the single element of a sequence.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

SingleOrDefaultAsync<T>(IQueryable<T>, CancellationToken)

Returns the single element of a sequence, or a default value, if the sequence contains no elements.

Declaration
public static Task<T> SingleOrDefaultAsync<T>(this IQueryable<T> query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<T>

A promise of the single element of a sequence.

Type Parameters
Name Description
T

The element type.

| Improve this Doc View Source

ToListAsync(IQueryable, CancellationToken)

Executes the query asynchronously and returns a list of items.

Declaration
public static Task<IList<object>> ToListAsync(this IQueryable query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IList<System.Object>>

A list of items.

| Improve this Doc View Source

ToListAsync<T>(IQueryable<T>, CancellationToken)

Executes the query asynchronously and returns a list of items.

Declaration
public static Task<IList<T>> ToListAsync<T>(this IQueryable<T> query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Linq.IQueryable<T> query

The query.

System.Threading.CancellationToken cancellationToken

The cancellation token.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IList<T>>

A list of items.

Type Parameters
Name Description
T

The element type.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX