EF Core uses a metadata model to describe how the application's entity types are mapped to the underlying database. This model is built using a set of conventions - heuristics that look for common patterns. The model can then be customized using mapping attributes (also known as data annotations) and/or calls to the ModelBuilder methods (also known as fluent API) in OnModelCreating, both of which will override the configuration performed by conventions. Most configuration can be applied to a model targeting any data store. Providers may also enable configuration that is specific to a particular data store and they can also ignore configuration that is not supported or not applicable. For documentation on provider-specific configuration see the Database providers section.

Microsoft documentation for EF Core: Creating and Configuring a Model

EF Core (Entity Framework Core) is a framework that helps developers work with a database in their .NET application. It provides a set of APIs that allow you to create, read, update, and delete data from a database.


The metadata model is like a blueprint or map that describes how the entities in your application (e.g., customer, order, product) are represented in the database (e.g., tables, columns). The model is built using conventions, which are like rules that EF Core follows to create the model based on common patterns it detects.


The ModelBuilder is like a tool that you can use to customize the model by adding additional rules or specifications. For example, you might use ModelBuilder to specify that a particular property in your entity should be mapped to a specific column in the database, or to specify that a particular relationship between two entities should be represented as a foreign key in the database.


OnModelCreating is a method that you can override in your code to customize the model. It's like a hook or callback that gets called when EF Core is building the model. You can use OnModelCreating to specify customizations using either the ModelBuilder or mapping attributes (also known as data annotations).


In everyday life, you can think of EF Core as a tool that helps you organize and manage your data, like a spreadsheet program. The metadata model is like the structure of the spreadsheet, with the conventions being the default formatting and layout rules. The ModelBuilder and OnModelCreating are like tools you can use to customize and fine-tune the spreadsheet to fit your specific needs. Just like how a spreadsheet program can work with different types of data stores (e.g., CSV files, Excel files, Google Sheets), EF Core can work with different types of databases (e.g., SQL Server, MySQL, PostgreSQL). 

Comments