RelationalModelCustomizer Class

Definition

Builds the model for a given context.

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

public class RelationalModelCustomizer : Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer
type RelationalModelCustomizer = class
    inherit ModelCustomizer
Public Class RelationalModelCustomizer
Inherits ModelCustomizer
Inheritance
RelationalModelCustomizer

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

RelationalModelCustomizer(ModelCustomizerDependencies)

Initializes a new instance of the RelationalModelCustomizer class.

Properties

Dependencies

Dependencies for this service.

(Inherited from ModelCustomizer)

Methods

Customize(ModelBuilder, DbContext)

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

Also, entity types found as DbSet<TEntity> properties on the context are mapped to tables named for the DbSet property names, and public static methods on the context marked with DbFunctionAttribute are mapped to database functions.

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.

(Inherited from ModelCustomizer)
FindDbFunctions(ModelBuilder, DbContext)

Adds to the model function mappings found as public static methods on the context marked with the DbFunctionAttribute.

FindSets(ModelBuilder, DbContext)

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

FindSets(ModelBuilder, DbContext)

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

(Inherited from ModelCustomizer)

Applies to