Export (0) Print
Expand All

DbSqlQuery(Of TEntity) 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 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(Of 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(Of TElement)(String, Object()). See DbSqlQuery for a non-generic version of this class.

System.Object
  System.Data.Entity.Infrastructure.DbRawSqlQuery(Of TEntity)
    System.Data.Entity.Infrastructure.DbSqlQuery(Of TEntity)

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

'Declaration
<SuppressMessageAttribute("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")> _
Public Class DbSqlQuery(Of TEntity As Class) _
	Inherits DbRawSqlQuery(Of TEntity)
'Usage
Dim instance As DbSqlQuery(Of TEntity)

Type Parameters

TEntity

The type of entities returned by the query.

The DbSqlQuery(Of TEntity) type exposes the following members.

  NameDescription
Protected methodDbSqlQuery(Of TEntity)Creates an instance of a DbSqlQuery(Of TEntity) 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.
Top

  NameDescription
Public methodAllAsync(Func(Of TElement, Boolean))Asynchronously determines whether all the elements of the query satisfy a condition. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodAllAsync(Func(Of TElement, Boolean), CancellationToken)Asynchronously determines whether all the elements of the query satisfy a condition. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodAnyAsyncAsynchronously determines whether the query contains any elements. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodAnyAsync(Func(Of TElement, Boolean))Asynchronously determines whether any element of the query satisfies a condition. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodAnyAsync(CancellationToken)Asynchronously determines whether the query contains any elements. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodAnyAsync(Func(Of TElement, Boolean), CancellationToken)Asynchronously determines whether any element of the query satisfies a condition. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodAsNoTrackingReturns a new query where the entities returned will not be cached in the DbContext.
Public methodAsStreaming Obsolete. Returns a new query that will stream the results instead of buffering.
Public methodContainsAsync(TElement)Asynchronously determines whether the query contains a specified element by using the default equality comparer. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodContainsAsync(TElement, CancellationToken)Asynchronously determines whether the query contains a specified element by using the default equality comparer. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodCountAsyncAsynchronously returns the number of elements in the query. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodCountAsync(Func(Of TElement, Boolean))Asynchronously returns the number of elements in the query that satisfy a condition. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodCountAsync(CancellationToken)Asynchronously returns the number of elements in the query. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodCountAsync(Func(Of TElement, Boolean), CancellationToken)Asynchronously returns the number of elements in the query that satisfy a condition. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodEqualsSpecifies whether this instance is equal to a specified object. (Overrides DbRawSqlQuery(Of TElement).Equals(Object).)
Protected methodFinalize (Inherited from Object.)
Public methodFirstAsyncAsynchronously returns the first element of the query. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodFirstAsync(Func(Of TElement, Boolean))Asynchronously returns the first element of the query that satisfies a specified condition. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodFirstAsync(CancellationToken)Asynchronously returns the first element of the query. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodFirstAsync(Func(Of TElement, Boolean), CancellationToken)Asynchronously returns the first element of the query that satisfies a specified condition. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodFirstOrDefaultAsyncAsynchronously returns the first element of the query, or a default value if the the query result contains no elements. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodFirstOrDefaultAsync(Func(Of 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(Of TElement).)
Public methodFirstOrDefaultAsync(CancellationToken)Asynchronously returns the first element of the query, or a default value if the the query result contains no elements. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodFirstOrDefaultAsync(Func(Of 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(Of TElement).)
Public methodForEachAsync(Action(Of TElement))Asynchronously enumerates the query results and performs the specified action on each element. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodForEachAsync(Action(Of TElement), CancellationToken)Asynchronously enumerates the query results and performs the specified action on each element. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodGetEnumeratorReturns an IEnumerator(Of T) which when enumerated will execute the SQL query against the database. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodGetHashCodeGets the hash code associated with this instance. (Overrides DbRawSqlQuery(Of TElement).GetHashCode.)
Public methodGetTypeGets the type associated with this instance.
Public methodLongCountAsyncAsynchronously returns an Int64 that represents the total number of elements in the query. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodLongCountAsync(Func(Of TElement, Boolean))Asynchronously returns an Int64 that represents the number of elements in the query that satisfy a condition. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodLongCountAsync(CancellationToken)Asynchronously returns an Int64 that represents the total number of elements in the query. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodLongCountAsync(Func(Of TElement, Boolean), CancellationToken)Asynchronously returns an Int64 that represents the number of elements in the query that satisfy a condition. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodMaxAsyncAsynchronously returns the maximum value of the query. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodMaxAsync(CancellationToken)Asynchronously returns the maximum value of the query. (Inherited from DbRawSqlQuery(Of TElement).)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodMinAsyncAsynchronously returns the minimum value of the query. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodMinAsync(CancellationToken)Asynchronously returns the minimum value of the query. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodSingleAsyncAsynchronously returns the only element of the query, and throws an exception if there is not exactly one element in the sequence. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodSingleAsync(Func(Of 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(Of TElement).)
Public methodSingleAsync(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(Of TElement).)
Public methodSingleAsync(Func(Of 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(Of TElement).)
Public methodSingleOrDefaultAsyncAsynchronously 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(Of TElement).)
Public methodSingleOrDefaultAsync(Func(Of 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(Of TElement).)
Public methodSingleOrDefaultAsync(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(Of TElement).)
Public methodSingleOrDefaultAsync(Func(Of 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(Of TElement).)
Public methodToArrayAsyncCreates an array from the query by enumerating it asynchronously. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodToArrayAsync(CancellationToken)Creates an array from the query by enumerating it asynchronously. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodToDictionaryAsync(Of TKey)(Func(Of TElement, TKey))Creates a Dictionary(Of TKey, TValue) from the query by enumerating it asynchronously according to a specified key selector function. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodToDictionaryAsync(Of TKey)(Func(Of TElement, TKey), IEqualityComparer(Of TKey))Creates a Dictionary(Of TKey, TValue) from the query by enumerating it asynchronously according to a specified key selector function and a comparer. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodToDictionaryAsync(Of TKey)(Func(Of TElement, TKey), CancellationToken)Creates a Dictionary(Of TKey, TValue) from the query by enumerating it asynchronously according to a specified key selector function. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodToDictionaryAsync(Of TKey)(Func(Of TElement, TKey), IEqualityComparer(Of TKey), CancellationToken)Creates a Dictionary(Of TKey, TValue) from the query by enumerating it asynchronously according to a specified key selector function and a comparer. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodToDictionaryAsync(Of TKey, TResult)(Func(Of TElement, TKey), Func(Of TElement, TResult))Creates a Dictionary(Of TKey, TValue) from the query by enumerating it asynchronously according to a specified key selector and an element selector function. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodToDictionaryAsync(Of TKey, TResult)(Func(Of TElement, TKey), Func(Of TElement, TResult), IEqualityComparer(Of TKey))Creates a Dictionary(Of 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(Of TElement).)
Public methodToDictionaryAsync(Of TKey, TResult)(Func(Of TElement, TKey), Func(Of TElement, TResult), CancellationToken)Creates a Dictionary(Of TKey, TValue) from the query by enumerating it asynchronously according to a specified key selector and an element selector function. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodToDictionaryAsync(Of TKey, TResult)(Func(Of TElement, TKey), Func(Of TElement, TResult), IEqualityComparer(Of TKey), CancellationToken)Creates a Dictionary(Of 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(Of TElement).)
Public methodToListAsyncCreates a List(Of T) from the query by enumerating it asynchronously. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodToListAsync(CancellationToken)Creates a List(Of T) from the query by enumerating it asynchronously. (Inherited from DbRawSqlQuery(Of TElement).)
Public methodToStringReturns a string representation of this instance. (Overrides DbRawSqlQuery(Of TElement).ToString.)
Top

  NameDescription
Explicit interface implemetationPrivate propertyIListSource.ContainsListCollectionReturns false. (Inherited from DbRawSqlQuery(Of TElement).)
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorReturns an IEnumerator which when enumerated will execute the SQL query against the database. (Inherited from DbRawSqlQuery(Of TElement).)
Explicit interface implemetationPrivate methodIListSource.GetListThrows an exception indicating that binding directly to a store query is not supported. (Inherited from DbRawSqlQuery(Of TElement).)
Explicit interface implemetationPrivate methodIDbAsyncEnumerable.GetAsyncEnumeratorReturns an IDbAsyncEnumerable which when enumerated will execute the SQL query against the database. (Inherited from DbRawSqlQuery(Of TElement).)
Explicit interface implemetationPrivate methodIDbAsyncEnumerable(Of TElement).GetAsyncEnumeratorReturns IDbAsyncEnumerator(Of T) which when enumerated will execute the SQL query against the database. (Inherited from DbRawSqlQuery(Of TElement).)
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