Table of Contents

Class RelationalCompiledQueryCacheKeyGenerator

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

Creates keys that uniquely identifies a query. This is used to store and lookup compiled versions of a query in a cache.

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

The service lifetime is Scoped. This means that each Microsoft.EntityFrameworkCore.DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

public class RelationalCompiledQueryCacheKeyGenerator : CompiledQueryCacheKeyGenerator
Inheritance
RelationalCompiledQueryCacheKeyGenerator

Constructors

RelationalCompiledQueryCacheKeyGenerator(CompiledQueryCacheKeyGeneratorDependencies, RelationalCompiledQueryCacheKeyGeneratorDependencies)

Initializes a new instance of the RelationalCompiledQueryCacheKeyGenerator class.

public RelationalCompiledQueryCacheKeyGenerator(CompiledQueryCacheKeyGeneratorDependencies dependencies, RelationalCompiledQueryCacheKeyGeneratorDependencies relationalDependencies)

Parameters

dependencies CompiledQueryCacheKeyGeneratorDependencies

Parameter object containing dependencies for this service.

relationalDependencies RelationalCompiledQueryCacheKeyGeneratorDependencies

Parameter object containing relational dependencies for this service.

Properties

RelationalDependencies

Dependencies used to create a RelationalCompiledQueryCacheKeyGenerator

protected virtual RelationalCompiledQueryCacheKeyGeneratorDependencies RelationalDependencies { get; }

Property Value

RelationalCompiledQueryCacheKeyGeneratorDependencies

Methods

GenerateCacheKey(Expression, bool)

Generates the cache key for the given query.

public override object GenerateCacheKey(Expression query, bool async)

Parameters

query Expression

The query to get the cache key for.

async bool

A value indicating whether the query will be executed asynchronously.

Returns

object

The cache key.

GenerateCacheKeyCore(Expression, bool)

Generates the cache key for the given query.

protected RelationalCompiledQueryCacheKeyGenerator.RelationalCompiledQueryCacheKey GenerateCacheKeyCore(Expression query, bool async)

Parameters

query Expression

The query to get the cache key for.

async bool

A value indicating whether the query will be executed asynchronously.

Returns

RelationalCompiledQueryCacheKeyGenerator.RelationalCompiledQueryCacheKey

The cache key.