ObjectQuery ObjectQuery ObjectQuery Class

Definition

This class implements untyped queries at the object-layer.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface")]
public abstract class ObjectQuery : System.Collections.IEnumerable, System.ComponentModel.IListSource, System.Data.Entity.Infrastructure.IDbAsyncEnumerable, System.Linq.IOrderedQueryable
type ObjectQuery = class
    interface IOrderedQueryable
    interface IQueryable
    interface IEnumerable
    interface IListSource
    interface IDbAsyncEnumerable
Public MustInherit Class ObjectQuery
Implements IDbAsyncEnumerable, IEnumerable, IListSource, IOrderedQueryable
Inheritance
ObjectQueryObjectQueryObjectQuery
Derived
Attributes
Implements

Properties

CommandText CommandText CommandText

Returns the command text for the query.

Context Context Context

Gets the object context associated with this object query.

EnablePlanCaching EnablePlanCaching EnablePlanCaching

Gets or sets a value that indicates whether the query plan should be cached.

MergeOption MergeOption MergeOption

Gets or sets how objects returned from a query are added to the object context.

Parameters Parameters Parameters

Gets the parameter collection for this object query.

Streaming Streaming Streaming

Whether the query is streaming or buffering

Methods

Execute(MergeOption) Execute(MergeOption) Execute(MergeOption)

Executes the untyped object query with the specified merge option.

ExecuteAsync(MergeOption) ExecuteAsync(MergeOption) ExecuteAsync(MergeOption)

Asynchronously executes the untyped object query with the specified merge option.

ExecuteAsync(MergeOption, CancellationToken) ExecuteAsync(MergeOption, CancellationToken) ExecuteAsync(MergeOption, CancellationToken)

Asynchronously executes the untyped object query with the specified merge option.

GetResultType() GetResultType() GetResultType()

Returns information about the result type of the query.

ToTraceString() ToTraceString() ToTraceString()

Returns the commands to execute against the data source.

Explicit Interface Implementations

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

IListSource.ContainsListCollection IListSource.ContainsListCollection IListSource.ContainsListCollection
IListSource.GetList() IListSource.GetList() IListSource.GetList()

Returns the collection as an IList used for data binding.

IDbAsyncEnumerable.GetAsyncEnumerator() IDbAsyncEnumerable.GetAsyncEnumerator() IDbAsyncEnumerable.GetAsyncEnumerator()

Returns an IDbAsyncEnumerator which when enumerated will execute the given SQL query against the database.

IQueryable.ElementType IQueryable.ElementType IQueryable.ElementType

Gets the result element type for this query instance.

IQueryable.Expression IQueryable.Expression IQueryable.Expression

Gets the expression describing this query. For queries built using LINQ builder patterns, returns a full LINQ expression tree; otherwise, returns a constant expression wrapping this query. Note that the default expression is not cached. This allows us to differentiate between LINQ and Entity-SQL queries.

IQueryable.Provider IQueryable.Provider IQueryable.Provider

Gets the IQueryProvider associated with this query instance.

Extension Methods

AsNoTracking(IQueryable) AsNoTracking(IQueryable) AsNoTracking(IQueryable)

Returns a new query where the entities returned will not be cached in the DbContext or ObjectContext. This method works by calling the AsNoTracking method of the underlying query object. If the underlying query object does not have an AsNoTracking method, then calling this method will have no affect.

AsStreaming(IQueryable) AsStreaming(IQueryable) AsStreaming(IQueryable)

Returns a new query that will stream the results instead of buffering. This method works by calling the AsStreaming method of the underlying query object. If the underlying query object does not have an AsStreaming method, then calling this method will have no affect.

ForEachAsync(IQueryable, Action<Object>) ForEachAsync(IQueryable, Action<Object>) ForEachAsync(IQueryable, Action<Object>)

Asynchronously enumerates the query results and performs the specified action on each element.

ForEachAsync(IQueryable, Action<Object>, CancellationToken) ForEachAsync(IQueryable, Action<Object>, CancellationToken) ForEachAsync(IQueryable, Action<Object>, CancellationToken)

Asynchronously enumerates the query results and performs the specified action on each element.

Include(IQueryable, String) Include(IQueryable, String) Include(IQueryable, String)

Specifies the related objects to include in the query results.

Load(IQueryable) Load(IQueryable) Load(IQueryable)

Enumerates the query such that for server queries such as those of DbSet<TEntity>, ObjectSet<TEntity> , ObjectQuery<T>, and others the results of the query will be loaded into the associated DbContext , ObjectContext or other cache on the client. This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list.

LoadAsync(IQueryable) LoadAsync(IQueryable) LoadAsync(IQueryable)

Asynchronously enumerates the query such that for server queries such as those of DbSet<TEntity>, ObjectSet<TEntity> , ObjectQuery<T>, and others the results of the query will be loaded into the associated DbContext , ObjectContext or other cache on the client. This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list.

LoadAsync(IQueryable, CancellationToken) LoadAsync(IQueryable, CancellationToken) LoadAsync(IQueryable, CancellationToken)

Asynchronously enumerates the query such that for server queries such as those of DbSet<TEntity>, ObjectSet<TEntity> , ObjectQuery<T>, and others the results of the query will be loaded into the associated DbContext , ObjectContext or other cache on the client. This is equivalent to calling ToList and then throwing away the list without the overhead of actually creating the list.

ToListAsync(IQueryable) ToListAsync(IQueryable) ToListAsync(IQueryable)

Creates a List<T> from an IQueryable by enumerating it asynchronously.

ToListAsync(IQueryable, CancellationToken) ToListAsync(IQueryable, CancellationToken) ToListAsync(IQueryable, CancellationToken)

Creates a List<T> from an IQueryable by enumerating it asynchronously.

Applies to