Delen via


ModelCacheKeyFactory Class

Definition

Creates keys that uniquely identifies the model for a given context. This is used to store and lookup a cached model for a given context. This default implementation uses the context type as they key, thus assuming that all contexts of a given type have the same model.

public class ModelCacheKeyFactory : Microsoft.EntityFrameworkCore.Infrastructure.IModelCacheKeyFactory
type ModelCacheKeyFactory = class
    interface IModelCacheKeyFactory
Public Class ModelCacheKeyFactory
Implements IModelCacheKeyFactory
Inheritance
ModelCacheKeyFactory
Implements

Remarks

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

See EF Core model caching for more information and examples.

Constructors

ModelCacheKeyFactory()
ModelCacheKeyFactory(ModelCacheKeyFactoryDependencies)

Initializes a new instance of the ModelCacheKeyFactory class.

Properties

Dependencies

Dependencies for this service.

Methods

Create(DbContext, Boolean)

Gets the model cache key for a given context.

Create(DbContext)

Gets the model cache key for a given context.

Applies to