DbSqlQuery Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 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(Type, String, Object[]). See DbSqlQuery<TEntity> for a generic version of this class.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification="Name is intentional")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Justification="FxCop rule is wrong; Db is not an abbreviation for data base.", MessageId="Db")]
public class DbSqlQuery : System.Data.Entity.Infrastructure.DbRawSqlQuery
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
public class DbSqlQuery : System.Data.Entity.Infrastructure.DbRawSqlQuery
type DbSqlQuery = class
inherit DbRawSqlQuery
Public Class DbSqlQuery
Inherits DbRawSqlQuery
- Inheritance
- Inheritance
-
DbSqlQuery
- Attributes
Constructors
DbSqlQuery() |
Creates an instance of a DbSqlQuery when called from the constructor of a derived type that will be used as a test double for SqlQuery(String, Object[]). 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. |
Methods
AsNoTracking() |
Returns a new query where the results of the query will not be tracked by the associated DbContext. |
AsStreaming() |
Obsolete.
Returns a new query that will stream the results instead of buffering. |
AsStreaming() |
Obsolete.
Returns a new query that will stream the results instead of buffering. (Inherited from DbRawSqlQuery) |
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. (Inherited from DbRawSqlQuery) |
ForEachAsync(Action<Object>) |
Asynchronously enumerates the query results and performs the specified action on each element. (Inherited from DbRawSqlQuery) |
GetEnumerator() |
Executes the query and returns an enumerator for the elements. |
GetEnumerator() |
Returns an IEnumerator which when enumerated will execute the SQL query against the database. (Inherited from DbRawSqlQuery) |
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. (Inherited from DbRawSqlQuery) |
ToListAsync(CancellationToken) |
Creates a List<T> from the query by enumerating it asynchronously. (Inherited from DbRawSqlQuery) |
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. (Inherited from DbRawSqlQuery) |
IListSource.ContainsListCollection |
Returns |
IListSource.ContainsListCollection |
Returns |
IListSource.GetList() |
Throws an exception indicating that binding directly to a store query is not supported. |
IListSource.GetList() |
Throws an exception indicating that binding directly to a store query is not supported. (Inherited from DbRawSqlQuery) |
Applies to
Entity Framework