Table of Contents

Interface IModelSource

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

Produces an IModel based on a context. This is typically implemented by database providers to ensure that any conventions and validation specific to their database are used.

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

public interface IModelSource

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 Implementation of database providers and extensions for more information and examples.

Methods

GetModel(DbContext, ModelCreationDependencies, bool)

Gets the model to be used.

IModel GetModel(DbContext context, ModelCreationDependencies modelCreationDependencies, bool designTime)

Parameters

context DbContext

The context the model is being produced for.

modelCreationDependencies ModelCreationDependencies

The dependencies object used during the creation of the model.

designTime bool

Whether the model should contain design-time configuration.

Returns

IModel

The model to be used.