DbContext.ConfigureConventions(ModelConfigurationBuilder) Method

Definition

Override this method to set defaults and configure conventions before they run. This method is invoked before OnModelCreating(ModelBuilder).

C#
protected internal virtual void ConfigureConventions (Microsoft.EntityFrameworkCore.ModelConfigurationBuilder configurationBuilder);

Parameters

configurationBuilder
ModelConfigurationBuilder

The builder being used to set defaults and configure conventions that will be used to build the model for this context.

Remarks

If a model is explicitly set on the options for this context (via UseModel(IModel)) then this method will not be run. However, it will still run when creating a compiled model.

See Pre-convention model building in EF Core for more information and examples.

Applies to

Product Versions
Entity Framework Core 6.0, 7.0, 8.0, 9.0