DbSqlQuery<'TEntity> Class

 

Represents a SQL query for entities that is created from a DbContext and is executed using the connection from that context. Instances of this class are obtained from the DbSet<'TEntity> instance for the entity type. 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 non-entities are created using SqlQuery<'TElement>. See DbSqlQuery for a non-generic version of this class.

Namespace:   System.Data.Entity.Infrastructure
Assembly:  EntityFramework (in EntityFramework.dll)

System.Object
  System.Data.Entity.Infrastructure.DbRawSqlQuery<'TElement>
    System.Data.Entity.Infrastructure.DbSqlQuery<'TEntity>

No code example is currently available or this language may not be supported.

Type Parameters

TEntity

The type of entities returned by the query.

NameDescription
System_CAPS_protmethodDbSqlQuery<'TEntity>()

Creates an instance of a DbSqlQuery<'TEntity> when called from the constructor of a derived type that will be used as a test double for SqlQuery. Methods and properties that will be used by the test double must be implemented by the test double except AsNoTracking and AsStreaming where the default implementation is a no-op.

NameDescription
System_CAPS_pubmethodAllAsync(Func<'TElement, Boolean>)

Asynchronously determines whether all the elements of the query satisfy a condition.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodAllAsync(Func<'TElement, Boolean>, CancellationToken)

Asynchronously determines whether all the elements of the query satisfy a condition.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodAnyAsync()

Asynchronously determines whether the query contains any elements.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodAnyAsync(CancellationToken)

Asynchronously determines whether the query contains any elements.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodAnyAsync(Func<'TElement, Boolean>)

Asynchronously determines whether any element of the query satisfies a condition.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodAnyAsync(Func<'TElement, Boolean>, CancellationToken)

Asynchronously determines whether any element of the query satisfies a condition.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodAsNoTracking()

Returns a new query where the entities returned will not be cached in the DbContext.

System_CAPS_pubmethodAsStreaming()

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

System_CAPS_pubmethodContainsAsync('TElement)

Asynchronously determines whether the query contains a specified element by using the default equality comparer.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodContainsAsync('TElement, CancellationToken)

Asynchronously determines whether the query contains a specified element by using the default equality comparer.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodCountAsync()

Asynchronously returns the number of elements in the query.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodCountAsync(CancellationToken)

Asynchronously returns the number of elements in the query.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodCountAsync(Func<'TElement, Boolean>)

Asynchronously returns the number of elements in the query that satisfy a condition.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodCountAsync(Func<'TElement, Boolean>, CancellationToken)

Asynchronously returns the number of elements in the query that satisfy a condition.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodEquals(Object)

Specifies whether this instance is equal to a specified object.(Overrides DbRawSqlQuery<'TElement>.Equals(Object).)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodFirstAsync()

Asynchronously returns the first element of the query.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodFirstAsync(CancellationToken)

Asynchronously returns the first element of the query.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodFirstAsync(Func<'TElement, Boolean>)

Asynchronously returns the first element of the query that satisfies a specified condition.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodFirstAsync(Func<'TElement, Boolean>, CancellationToken)

Asynchronously returns the first element of the query that satisfies a specified condition.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodFirstOrDefaultAsync()

Asynchronously returns the first element of the query, or a default value if the the query result contains no elements.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodFirstOrDefaultAsync(CancellationToken)

Asynchronously returns the first element of the query, or a default value if the the query result contains no elements.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodFirstOrDefaultAsync(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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodFirstOrDefaultAsync(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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodForEachAsync(Action<'TElement>)

Asynchronously enumerates the query results and performs the specified action on each element.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodForEachAsync(Action<'TElement>, CancellationToken)

Asynchronously enumerates the query results and performs the specified action on each element.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodGetEnumerator()

Returns an IEnumerator<'T> which when enumerated will execute the SQL query against the database.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodGetHashCode()

Gets the hash code associated with this instance.(Overrides DbRawSqlQuery<'TElement>.GetHashCode().)

System_CAPS_pubmethodGetType()

Gets the type associated with this instance.

System_CAPS_pubmethodLongCountAsync()

Asynchronously returns an Int64 that represents the total number of elements in the query.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodLongCountAsync(CancellationToken)

Asynchronously returns an Int64 that represents the total number of elements in the query.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodLongCountAsync(Func<'TElement, Boolean>)

Asynchronously returns an Int64 that represents the number of elements in the query that satisfy a condition.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodLongCountAsync(Func<'TElement, Boolean>, CancellationToken)

Asynchronously returns an Int64 that represents the number of elements in the query that satisfy a condition.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodMaxAsync()

Asynchronously returns the maximum value of the query.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodMaxAsync(CancellationToken)

Asynchronously returns the maximum value of the query.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodMinAsync()

Asynchronously returns the minimum value of the query.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodMinAsync(CancellationToken)

Asynchronously returns the minimum value of the query.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodSingleAsync()

Asynchronously returns the only element of the query, and throws an exception if there is not exactly one element in the sequence.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodSingleAsync(CancellationToken)

Asynchronously returns the only element of the query, and throws an exception if there is not exactly one element in the sequence.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodSingleAsync(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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodSingleAsync(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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodSingleOrDefaultAsync()

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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodSingleOrDefaultAsync(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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodSingleOrDefaultAsync(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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodSingleOrDefaultAsync(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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToArrayAsync()

Creates an array from the query by enumerating it asynchronously.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToArrayAsync(CancellationToken)

Creates an array from the query by enumerating it asynchronously.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToDictionaryAsync<'TKey>(Func<'TElement, 'TKey>)

Creates a Dictionary<'TKey, 'TValue> from the query by enumerating it asynchronously according to a specified key selector function.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToDictionaryAsync<'TKey>(Func<'TElement, 'TKey>, CancellationToken)

Creates a Dictionary<'TKey, 'TValue> from the query by enumerating it asynchronously according to a specified key selector function.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToDictionaryAsync<'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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToDictionaryAsync<'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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToDictionaryAsync<'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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToDictionaryAsync<'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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToDictionaryAsync<'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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToDictionaryAsync<'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.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToListAsync()

Creates a List<'T> from the query by enumerating it asynchronously.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToListAsync(CancellationToken)

Creates a List<'T> from the query by enumerating it asynchronously.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubmethodToString()

Returns a string representation of this instance.(Overrides DbRawSqlQuery<'TElement>.ToString().)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIEnumerable.GetEnumerator()

Returns an IEnumerator which when enumerated will execute the SQL query against the database.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIListSource.GetList()

Throws an exception indicating that binding directly to a store query is not supported.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDbAsyncEnumerable.GetAsyncEnumerator()

Returns an IDbAsyncEnumerable which when enumerated will execute the SQL query against the database.(Inherited from DbRawSqlQuery<'TElement>.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDbAsyncEnumerable<'TElement>.GetAsyncEnumerator()

(Inherited from DbRawSqlQuery<'TElement>.)

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: