Table of Contents

Class QueryCompilationContext

Namespace
Microsoft.EntityFrameworkCore.Query
Assembly
Microsoft.EntityFrameworkCore.dll

The primary data structure representing the state/components used during query compilation.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public class QueryCompilationContext
Inheritance
QueryCompilationContext
Inherited Members

Remarks

Constructors

QueryCompilationContext(QueryCompilationContextDependencies, bool)

Creates a new instance of the QueryCompilationContext class.

public QueryCompilationContext(QueryCompilationContextDependencies dependencies, bool async)

Parameters

dependencies QueryCompilationContextDependencies

Parameter object containing dependencies for this class.

async bool

A bool value indicating whether it is for async query.

Fields

NotTranslatedExpression

Expression representing a not translated expression in query tree during translation phase.

This property is typically used by database providers (and other extensions). It is generally not used in application code.

public static readonly Expression NotTranslatedExpression

Field Value

Expression

QueryContextParameter

ParameterExpression representing QueryContext parameter in query expression.

This property is typically used by database providers (and other extensions). It is generally not used in application code.

public static readonly ParameterExpression QueryContextParameter

Field Value

ParameterExpression

QueryParameterPrefix

Prefix for all the query parameters generated during parameter extraction in query pipeline.

This property is typically used by database providers (and other extensions). It is generally not used in application code.

public const string QueryParameterPrefix = "__"

Field Value

string

Properties

ContextOptions

The ContextOptions to use during query compilation.

public virtual IDbContextOptions ContextOptions { get; }

Property Value

IDbContextOptions

ContextType

The CLR type of derived DbContext to use during query compilation.

public virtual Type ContextType { get; }

Property Value

Type

Dependencies

Dependencies for this service.

protected virtual QueryCompilationContextDependencies Dependencies { get; }

Property Value

QueryCompilationContextDependencies

IgnoreAutoIncludes

A value indicating whether eager loaded navigations are ignored in this query.

public virtual bool IgnoreAutoIncludes { get; }

Property Value

bool

IgnoreQueryFilters

A value indicating whether query filters are ignored in this query.

public virtual bool IgnoreQueryFilters { get; }

Property Value

bool

IsAsync

A value indicating whether it is async query.

public virtual bool IsAsync { get; }

Property Value

bool

IsBuffering

A value indicating whether the underlying server query needs to pre-buffer all data.

public virtual bool IsBuffering { get; }

Property Value

bool

Logger

The query logger to use during query compilation.

public virtual IDiagnosticsLogger<DbLoggerCategory.Query> Logger { get; }

Property Value

IDiagnosticsLogger<DbLoggerCategory.Query>

Model

The model to use during query compilation.

public virtual IModel Model { get; }

Property Value

IModel

QueryTrackingBehavior

A value indicating QueryTrackingBehavior of the query.

public virtual QueryTrackingBehavior QueryTrackingBehavior { get; }

Property Value

QueryTrackingBehavior

Tags

The set of tags applied to this query.

public virtual ISet<string> Tags { get; }

Property Value

ISet<string>

Methods

AddTag(string)

Adds a tag to Tags.

public virtual void AddTag(string tag)

Parameters

tag string

The tag to add.

CreateQueryExecutor<TResult>(Expression)

Creates the query executor func which gives results for this query.

public virtual Func<QueryContext, TResult> CreateQueryExecutor<TResult>(Expression query)

Parameters

query Expression

The query to generate executor for.

Returns

Func<QueryContext, TResult>

Returns Func<T, TResult> which can be invoked to get results of this query.

Type Parameters

TResult

The result type of this query.

RegisterRuntimeParameter(string, LambdaExpression)

Registers a runtime parameter that is being added at some point during the compilation phase. A lambda must be provided, which will extract the parameter's value from the QueryContext every time the query is executed.

public virtual ParameterExpression RegisterRuntimeParameter(string name, LambdaExpression valueExtractor)

Parameters

name string
valueExtractor LambdaExpression

Returns

ParameterExpression