Export (0) Print
Expand All

DbRawSqlQuery Class

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

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.Object
  System.Data.Entity.Infrastructure.DbRawSqlQuery
    System.Data.Entity.Infrastructure.DbSqlQuery

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

[SuppressMessageAttribute("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessageAttribute("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface")]
public class DbRawSqlQuery : IEnumerable, 
	IListSource, IDbAsyncEnumerable

The DbRawSqlQuery type exposes the following members.

  NameDescription
Public methodAsStreaming Obsolete. Returns a new query that will stream the results instead of buffering.
Public methodEqualsSpecifies whether the query is equal to the specified object. (Overrides Object.Equals(Object).)
Protected methodFinalize (Inherited from Object.)
Public methodForEachAsync(Action<Object>)Asynchronously enumerates the query results and performs the specified action on each element.
Public methodForEachAsync(Action<Object>, CancellationToken)Asynchronously enumerates the query results and performs the specified action on each element.
Public methodGetEnumeratorReturns an IEnumerator which when enumerated will execute the SQL query against the database.
Public methodGetHashCodeGets the hash code associated with the query. (Overrides Object.GetHashCode().)
Public methodGetTypeGets the type associated with the query.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToListAsync()Creates a List<T> from the query by enumerating it asynchronously.
Public methodToListAsync(CancellationToken)Creates a List<T> from the query by enumerating it asynchronously.
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().)
Top

  NameDescription
Explicit interface implemetationPrivate propertyIListSource.ContainsListCollectionReturns false.
Explicit interface implemetationPrivate methodIListSource.GetListThrows an exception indicating that binding directly to a store query is not supported.
Explicit interface implemetationPrivate methodIDbAsyncEnumerable.GetAsyncEnumeratorReturns an IDbAsyncEnumerable which when enumerated will execute the SQL query against the database.
Top

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