concept Add - Migration command in category entity framework

This is an excerpt from Manning's book Entity Framework Core in Action.
If your application has a separate project for the application’s DbContext from the main startup application (as the book app does), the
Add-Migration
command is a little more complex.
Describing all the command-line migration options would take up too much space and push out the important information on approaches to database changes. But you can check out the links to Microsoft’s detailed information on these commands. For a more complete description of the
Add-Migration
command, see section 2.2.3.
What happens when you call the Add-Migration command?
Figure 11.2 shows what happens when you call the
Add-Migration
command. It uses the application’s DbContext’s method,Database.Model
, introduced in section 9.6.Figure 11.2 Running the
Add-Migration
command to create a new EF Core migration. The command compares two models of the database. One comes from our current application, with its DbContext, entity classes, and EF Core configuration; and the other is from the <MyContextName>ModelSnapshot.cs file (which is empty if this is your first migration). By comparing these two models, EF Core can create code that will update the database schema to match EF Core’s current database model.![]()
Three new files are added to your application as a result of running the
Add-Migration
command. By default, these files are written to a directory called Migrations in the project that contains your application’s DbContext. They contain the commands that are used in the second stage of applying migrations to a database.