Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

DbContext.ConfigureConventions(ModelConfigurationBuilder) Method

Definition

Namespace:
Microsoft.EntityFrameworkCore
Assembly:
Microsoft.EntityFrameworkCore.dll
Package:
Microsoft.EntityFrameworkCore v10.0.0
Package:
Microsoft.EntityFrameworkCore v6.0.0
Package:
Microsoft.EntityFrameworkCore v7.0.0
Package:
Microsoft.EntityFrameworkCore v8.0.0
Package:
Microsoft.EntityFrameworkCore v9.0.0
Source:
DbContext.cs
Source:
DbContext.cs
Source:
DbContext.cs
Source:
DbContext.cs
Source:
DbContext.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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)

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


Feedback

Was this page helpful?