Class QueryContext
- Namespace
- Microsoft.EntityFrameworkCore.Query
- Assembly
- Microsoft.EntityFrameworkCore.dll
The principal data structure used by a compiled query during execution.
This type is typically used by database providers (and other extensions). It is generally not used in application code.
public abstract class QueryContext : IParameterValues
- Inheritance
-
QueryContext
- Implements
- Inherited Members
Remarks
See Implementation of database providers and extensions and How EF Core queries work for more information and examples.
Constructors
QueryContext(QueryContextDependencies)
Creates a new QueryContext instance.
This type is typically used by database providers (and other extensions). It is generally not used in application code.
protected QueryContext(QueryContextDependencies dependencies)
Parameters
dependencies
QueryContextDependenciesThe dependencies to use.
Properties
CancellationToken
The cancellation token to use while executing the query.
public virtual CancellationToken CancellationToken { get; set; }
Property Value
CommandLogger
The command logger to use while executing the query.
public virtual IDiagnosticsLogger<DbLoggerCategory.Database.Command> CommandLogger { get; }
Property Value
ConcurrencyDetector
The concurrency detector to use while executing the query.
public virtual IConcurrencyDetector ConcurrencyDetector { get; }
Property Value
Context
The current DbContext in using while executing the query.
public virtual DbContext Context { get; }
Property Value
Dependencies
Dependencies for this service.
protected virtual QueryContextDependencies Dependencies { get; }
Property Value
ExceptionDetector
The exception detector to use while executing the query.
public virtual IExceptionDetector ExceptionDetector { get; }
Property Value
ExecutionStrategy
The execution strategy to use while executing the query.
public virtual IExecutionStrategy ExecutionStrategy { get; }
Property Value
ParameterValues
The parameter values to use while executing the query.
public virtual IReadOnlyDictionary<string, object?> ParameterValues { get; }
Property Value
QueryLogger
The query logger to use while executing the query.
public virtual IDiagnosticsLogger<DbLoggerCategory.Query> QueryLogger { get; }
Property Value
Methods
AddParameter(string, object?)
Adds a parameter to ParameterValues for this query.
public virtual void AddParameter(string name, object? value)
Parameters
InitializeStateManager(bool)
Initializes the IStateManager to be used with this QueryContext.
public virtual void InitializeStateManager(bool standAlone = false)
Parameters
standAlone
boolWhether a stand-alone IStateManager should be created to perform identity resolution.
SetNavigationIsLoaded(object, INavigationBase)
Sets the navigation for given entity as loaded.
public virtual void SetNavigationIsLoaded(object entity, INavigationBase navigation)
Parameters
entity
objectThe entity instance.
navigation
INavigationBaseThe navigation property.
StartTracking(IEntityType, object, ValueBuffer)
This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.
[EntityFrameworkInternal]
public virtual InternalEntityEntry StartTracking(IEntityType entityType, object entity, ValueBuffer valueBuffer)
Parameters
entityType
IEntityTypeentity
objectvalueBuffer
ValueBuffer
Returns
TryGetEntry(IKey, object[], bool, out bool)
This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.
[EntityFrameworkInternal]
public virtual InternalEntityEntry? TryGetEntry(IKey key, object[] keyValues, bool throwOnNullKey, out bool hasNullKey)