DbRawSqlQuery 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<TElement> for a generic version of this class.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface")]
public class DbRawSqlQuery : System.Collections.IEnumerable, System.ComponentModel.IListSource, System.Data.Entity.Infrastructure.IDbAsyncEnumerable
type DbRawSqlQuery = class
    interface IEnumerable
    interface IListSource
    interface IDbAsyncEnumerable
Public Class DbRawSqlQuery
Implements IDbAsyncEnumerable, IEnumerable, IListSource
Inheritance
DbRawSqlQuery
Derived
Attributes
Implements

Methods

AsStreaming()
Obsolete.

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

Equals(Object)

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

ForEachAsync(Action<Object>, CancellationToken)

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

ForEachAsync(Action<Object>)

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

GetEnumerator()

Returns an IEnumerator 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.

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.

IListSource.ContainsListCollection

Returns false.

IListSource.GetList()

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

Applies to