ModelSource ModelSource Class

Definition

A base 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.

public abstract class ModelSource : IModelSource
Public MustInherit Class ModelSource
    Implements IModelSource
Inheritance
System.ObjectSystem.Object
ModelSourceModelSource
Implements

Constructors

ModelSource(IDbSetFinder, ICoreConventionSetBuilder, IModelCustomizer, IModelCacheKeyFactory) 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.

protected ModelSource(IDbSetFinder setFinder, ICoreConventionSetBuilder coreConventionSetBuilder, IModelCustomizer modelCustomizer, IModelCacheKeyFactory modelCacheKeyFactory)
Protected Sub New(setFinder As IDbSetFinder, coreConventionSetBuilder As ICoreConventionSetBuilder, modelCustomizer As IModelCustomizer, modelCacheKeyFactory As IModelCacheKeyFactory)
Parameters

Properties

CoreConventionSetBuilder CoreConventionSetBuilder

Gets the ICoreConventionSetBuilder that will build the conventions to be used to build the model.

protected virtual ICoreConventionSetBuilder CoreConventionSetBuilder { get; }
Protected Overridable ReadOnly Property CoreConventionSetBuilder As ICoreConventionSetBuilder

ModelCacheKeyFactory ModelCacheKeyFactory

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

protected virtual IModelCacheKeyFactory ModelCacheKeyFactory { get; }
Protected Overridable ReadOnly Property ModelCacheKeyFactory As IModelCacheKeyFactory

ModelCustomizer ModelCustomizer

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

protected virtual IModelCustomizer ModelCustomizer { get; }
Protected Overridable ReadOnly Property ModelCustomizer As IModelCustomizer

SetFinder SetFinder

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

protected virtual IDbSetFinder SetFinder { get; }
Protected Overridable ReadOnly Property SetFinder As IDbSetFinder

Methods

CreateConventionSet(IConventionSetBuilder) CreateConventionSet(IConventionSetBuilder)

Creates the convention set to be used for the model. Uses the CoreConventionSetBuilder if conventionSetBuilder is null.

protected virtual ConventionSet CreateConventionSet(IConventionSetBuilder conventionSetBuilder)
Protected Overridable Function CreateConventionSet(conventionSetBuilder As IConventionSetBuilder) As ConventionSet
Parameters
conventionSetBuilder
IConventionSetBuilder IConventionSetBuilder

The convention set builder to be used.

Returns

The convention set to be used.

CreateModel(DbContext, IConventionSetBuilder, IModelValidator) CreateModel(DbContext, IConventionSetBuilder, IModelValidator)

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

protected virtual IModel CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
Protected Overridable Function CreateModel(context As DbContext, conventionSetBuilder As IConventionSetBuilder, validator As IModelValidator) As IModel
Parameters
context
DbContext DbContext

The context the model is being produced for.

conventionSetBuilder
IConventionSetBuilder IConventionSetBuilder

The convention set to use when creating the model.

validator
IModelValidator IModelValidator

The validator to verify the model can be successfully used with the context.

Returns

The model to be used.

Equals(Object) Equals(Object)

Inherited from System.Object

Equals(Object, Object) Equals(Object, Object)

Inherited from System.Object

FindSets(ModelBuilder, DbContext) FindSets(ModelBuilder, DbContext)

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

protected virtual void FindSets(ModelBuilder modelBuilder, DbContext context)
Protected Overridable Sub FindSets(modelBuilder As ModelBuilder, context As DbContext)
Parameters
modelBuilder
ModelBuilder ModelBuilder

The ModelBuilder being used to build the model.

context
DbContext DbContext

The context to find DbSet<TEntity> properties on.

GetHashCode() GetHashCode()

Inherited from System.Object

GetModel(DbContext, IConventionSetBuilder, IModelValidator) GetModel(DbContext, IConventionSetBuilder, IModelValidator)

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

public virtual IModel GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
Public Overridable Function GetModel(context As DbContext, conventionSetBuilder As IConventionSetBuilder, validator As IModelValidator) As IModel
Parameters
context
DbContext DbContext

The context the model is being produced for.

conventionSetBuilder
IConventionSetBuilder IConventionSetBuilder

The convention set to use when creating the model.

validator
IModelValidator IModelValidator

The validator to verify the model can be successfully used with the context.

Returns

The model to be used.

GetType() GetType()

Inherited from System.Object

MemberwiseClone() MemberwiseClone()

Inherited from System.Object

ReferenceEquals(Object, Object) ReferenceEquals(Object, Object)

Inherited from System.Object

ToString() ToString()

Inherited from System.Object