Delen via


ModelCustomizer Class

Definition

Builds the model for a given context. This implementation builds the model by calling OnModelCreating(ModelBuilder) on the context.

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

public class ModelCustomizer : Microsoft.EntityFrameworkCore.Infrastructure.IModelCustomizer
type ModelCustomizer = class
    interface IModelCustomizer
Public Class ModelCustomizer
Implements IModelCustomizer
Inheritance
ModelCustomizer
Derived
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 Implementation of database providers and extensions for more information and examples.

Constructors

ModelCustomizer()
ModelCustomizer(ModelCustomizerDependencies)

Initializes a new instance of the ModelCustomizer class.

Properties

Dependencies

Dependencies for this service.

Methods

Customize(ModelBuilder, DbContext)

Performs additional configuration of the model in addition to what is discovered by convention. This default implementation builds the model for a given context by calling OnModelCreating(ModelBuilder) on the context.

FindSets(ModelBuilder, DbContext)

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

Applies to