ModelSource Class

Definition

An implementation of IModelSource that produces a model based on the DbSet<TEntity> properties exposed on the context. The model is cached to avoid recreating it every time it is requested.

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

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.

public abstract class ModelSource : Microsoft.EntityFrameworkCore.Infrastructure.IModelSource
public class ModelSource : Microsoft.EntityFrameworkCore.Infrastructure.IModelSource
type ModelSource = class
    interface IModelSource
Public MustInherit Class ModelSource
Implements IModelSource
Public Class ModelSource
Implements IModelSource
Inheritance
ModelSource
Implements

Constructors

ModelSource(IDbSetFinder, ICoreConventionSetBuilder, IModelCustomizer, IModelCacheKeyFactory)

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

ModelSource(ModelSourceDependencies)

Creates a new ModelSource instance.

Properties

CoreConventionSetBuilder

Gets the Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ICoreConventionSetBuilder that will build the conventions to be used to build the model.

Dependencies

Dependencies used to create a ModelSource

ModelCacheKeyFactory

Gets the IModelCacheKeyFactory that will create keys used to store and lookup models the model cache.

ModelCustomizer

Gets the IModelCustomizer that will perform additional configuration of the model in addition to what is discovered by convention.

SetFinder

Gets the Microsoft.EntityFrameworkCore.Internal.IDbSetFinder that will locate the DbSet<TEntity> properties on the derived context.

Methods

CreateConventionSet(IConventionSetBuilder)

Creates the convention set to be used for the model. Only uses the Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.CoreConventionSetBuilder if conventionSetBuilder is null.

CreateModel(DbContext, IConventionSetBuilder)
Obsolete.

Creates the model. This method is called when the model was not found in the cache.

CreateModel(DbContext, IConventionSetBuilder, IModelValidator)

Creates the model. This method is called when the model was not found in the cache.

CreateModel(DbContext, IConventionSetBuilder, IModelValidator)

Creates the model. This method is called when the model was not found in the cache.

CreateModel(DbContext, IConventionSetBuilder, ModelDependencies)

Creates the model. This method is called when the model was not found in the cache.

FindSets(ModelBuilder, DbContext)

Adds the entity types found in DbSet<TEntity> properties on the context to the model.

GetModel(DbContext, IConventionSetBuilder)
Obsolete.

Returns the model from the cache, or creates a model if it is not present in the cache.

GetModel(DbContext, IConventionSetBuilder, IModelValidator)

Returns the model from the cache, or creates a model if it is not present in the cache.

GetModel(DbContext, IConventionSetBuilder, IModelValidator)

Returns the model from the cache, or creates a model if it is not present in the cache.

GetModel(DbContext, IConventionSetBuilder, ModelDependencies)

Returns the model from the cache, or creates a model if it is not present in the cache.

Applies to