DbRawSqlQuery<TElement> Class

Definition

Represents a SQL query for non-entities that is created from a DbContext and is executed using the connection from that context. Instances of this class are obtained from the Database instance. The query is not executed when this object is created; it is executed each time it is enumerated, for example by using foreach. SQL queries for entities are created using SqlQuery(String, Object[]). See DbRawSqlQuery for a non-generic version of this class.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
public class DbRawSqlQuery<TElement> : System.Collections.Generic.IEnumerable<TElement>, System.ComponentModel.IListSource, System.Data.Entity.Infrastructure.IDbAsyncEnumerable<TElement>
type DbRawSqlQuery<'Element> = class
    interface seq<'Element>
    interface IEnumerable
    interface IListSource
    interface IDbAsyncEnumerable<'Element>
    interface IDbAsyncEnumerable
Public Class DbRawSqlQuery(Of TElement)
Implements IDbAsyncEnumerable(Of TElement), IEnumerable(Of TElement), IListSource

Type Parameters

TElement

The type of elements returned by the query.

Inheritance
DbRawSqlQuery<TElement>
Derived
Attributes
Implements

Methods

AllAsync(Func<TElement,Boolean>)

Asynchronously determines whether all the elements of the query satisfy a condition.

AllAsync(Func<TElement,Boolean>, CancellationToken)

Asynchronously determines whether all the elements of the query satisfy a condition.

AnyAsync()

Asynchronously determines whether the query contains any elements.

AnyAsync(CancellationToken)

Asynchronously determines whether the query contains any elements.

AnyAsync(Func<TElement,Boolean>)

Asynchronously determines whether any element of the query satisfies a condition.

AnyAsync(Func<TElement,Boolean>, CancellationToken)

Asynchronously determines whether any element of the query satisfies a condition.

AsStreaming()
Obsolete.

Returns a new query that will stream the results instead of buffering.

ContainsAsync(TElement)

Asynchronously determines whether the query contains a specified element by using the default equality comparer.

ContainsAsync(TElement, CancellationToken)

Asynchronously determines whether the query contains a specified element by using the default equality comparer.

CountAsync()

Asynchronously returns the number of elements in the query.

CountAsync(CancellationToken)

Asynchronously returns the number of elements in the query.

CountAsync(Func<TElement,Boolean>)

Asynchronously returns the number of elements in the query that satisfy a condition.

CountAsync(Func<TElement,Boolean>, CancellationToken)

Asynchronously returns the number of elements in the query that satisfy a condition.

Equals(Object)

Determines whether the specified object is equal to the current object.

FirstAsync()

Asynchronously returns the first element of the query.

FirstAsync(CancellationToken)

Asynchronously returns the first element of the query.

FirstAsync(Func<TElement,Boolean>)

Asynchronously returns the first element of the query that satisfies a specified condition.

FirstAsync(Func<TElement,Boolean>, CancellationToken)

Asynchronously returns the first element of the query that satisfies a specified condition.

FirstOrDefaultAsync()

Asynchronously returns the first element of the query, or a default value if the the query result contains no elements.

FirstOrDefaultAsync(CancellationToken)

Asynchronously returns the first element of the query, or a default value if the the query result contains no elements.

FirstOrDefaultAsync(Func<TElement,Boolean>)

Asynchronously returns the first element of the query that satisfies a specified condition or a default value if no such element is found.

FirstOrDefaultAsync(Func<TElement,Boolean>, CancellationToken)

Asynchronously returns the first element of the query that satisfies a specified condition or a default value if no such element is found.

ForEachAsync(Action<TElement>)

Asynchronously enumerates the query results and performs the specified action on each element.

ForEachAsync(Action<TElement>, CancellationToken)

Asynchronously enumerates the query results and performs the specified action on each element.

GetEnumerator()

Returns an IEnumerator<T> which when enumerated will execute the SQL query against the database.

GetHashCode()

Serves as the default hash function.

GetType()

Gets the Type of the current instance.

LongCountAsync()

Asynchronously returns an Int64 that represents the total number of elements in the query.

LongCountAsync(CancellationToken)

Asynchronously returns an Int64 that represents the total number of elements in the query.

LongCountAsync(Func<TElement,Boolean>)

Asynchronously returns an Int64 that represents the number of elements in the query that satisfy a condition.

LongCountAsync(Func<TElement,Boolean>, CancellationToken)

Asynchronously returns an Int64 that represents the number of elements in the query that satisfy a condition.

MaxAsync()

Asynchronously returns the maximum value of the query.

MaxAsync(CancellationToken)

Asynchronously returns the maximum value of the query.

MinAsync()

Asynchronously returns the minimum value of the query.

MinAsync(CancellationToken)

Asynchronously returns the minimum value of the query.

SingleAsync()

Asynchronously returns the only element of the query, and throws an exception if there is not exactly one element in the sequence.

SingleAsync(CancellationToken)

Asynchronously returns the only element of the query, and throws an exception if there is not exactly one element in the sequence.

SingleAsync(Func<TElement,Boolean>)

Asynchronously returns the only element of the query that satisfies a specified condition, and throws an exception if more than one such element exists.

SingleAsync(Func<TElement,Boolean>, CancellationToken)

Asynchronously returns the only element of the query that satisfies a specified condition, and throws an exception if more than one such element exists.

SingleOrDefaultAsync()

Asynchronously returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.

SingleOrDefaultAsync(CancellationToken)

Asynchronously returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.

SingleOrDefaultAsync(Func<TElement,Boolean>)

Asynchronously returns the only element of the query that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.

SingleOrDefaultAsync(Func<TElement,Boolean>, CancellationToken)

Asynchronously returns the only element of the query that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.

ToArrayAsync()

Creates an array from the query by enumerating it asynchronously.

ToArrayAsync(CancellationToken)

Creates an array from the query by enumerating it asynchronously.

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector and an element selector function.

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector and an element selector function.

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, IEqualityComparer<TKey>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function, a comparer, and an element selector function.

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, IEqualityComparer<TKey>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function, a comparer, and an element selector function.

ToDictionaryAsync<TKey>(Func<TElement,TKey>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function.

ToDictionaryAsync<TKey>(Func<TElement,TKey>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function.

ToDictionaryAsync<TKey>(Func<TElement,TKey>, IEqualityComparer<TKey>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function and a comparer.

ToDictionaryAsync<TKey>(Func<TElement,TKey>, IEqualityComparer<TKey>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function and a comparer.

ToListAsync()

Creates a List<T> from the query by enumerating it asynchronously.

ToListAsync(CancellationToken)

Creates a List<T> from the query by enumerating it asynchronously.

ToString()

Returns a String that contains the SQL string that was set when the query was created. The parameters are not included.

Explicit Interface Implementations

IDbAsyncEnumerable.GetAsyncEnumerator()

Returns an IDbAsyncEnumerable which when enumerated will execute the SQL query against the database.

IDbAsyncEnumerable<TElement>.GetAsyncEnumerator()

Returns an IDbAsyncEnumerable<T> which when enumerated will execute the SQL query against the database.

IEnumerable.GetEnumerator()

Returns an IEnumerator which when enumerated will execute the SQL query against the database.

IListSource.ContainsListCollection

Returns false.

IListSource.GetList()

Throws an exception indicating that binding directly to a store query is not supported.

Applies to