DbContext.ConfigureConventions(ModelConfigurationBuilder) Method


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

protected internal virtual void ConfigureConventions (Microsoft.EntityFrameworkCore.ModelConfigurationBuilder configurationBuilder);
abstract member ConfigureConventions : Microsoft.EntityFrameworkCore.ModelConfigurationBuilder -> unit
override this.ConfigureConventions : Microsoft.EntityFrameworkCore.ModelConfigurationBuilder -> unit
Protected Friend Overridable Sub ConfigureConventions (configurationBuilder As ModelConfigurationBuilder)



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


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