DbSqlQuery<TEntity> Class

Represents a SQL query for entities that are 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 the Database. See DbSqlQuery for a non-generic version of this class.


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

public class DbSqlQuery<TEntity> : IEnumerable<TEntity>, 
	IEnumerable, IListSource 
where TEntity : class

Type Parameters


The entity.

The DbSqlQuery<TEntity> type exposes the following members.

Public methodAsNoTrackingReturns a new query where the results of the query will not be tracked by the associated DbContext.
Public methodEqualsReturns whether the specified query is equal to the current query. (Overrides Object.Equals(Object).)
Protected methodFinalize (Inherited from Object.)
Public methodGetEnumeratorExecutes the query and returns an enumerator for the elements.
Public methodGetHashCodeReturns the hash function for the specified query. (Overrides Object.GetHashCode().)
Public methodGetTypeGets the type for the current query.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToStringReturns a String that contains the SQL string that was set when the query was created. The parameters are not included. (Overrides Object.ToString().)

Explicit interface implemetationPrivate propertyIListSource.ContainsListCollectionReturns false.
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorExecutes the query and returns an enumerator for the elements.
Explicit interface implemetationPrivate methodIListSource.GetListThrows an exception indicating that binding directly to a store query is not supported.

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