Table of Contents

Interface IModelCacheKeyFactory

Namespace
Microsoft.EntityFrameworkCore.Infrastructure
Assembly
Microsoft.EntityFrameworkCore.dll

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.

public interface IModelCacheKeyFactory

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.

Methods

Create(DbContext, bool)

Gets the model cache key for a given context.

object Create(DbContext context, bool designTime)

Parameters

context DbContext

The context to get the model cache key for.

designTime bool

Whether the model should contain design-time configuration.

Returns

object

The created key.