EF Core migration files encapsulate all the steps needed to reach a database structure that conforms to your code models, but in order to apply those steps to your database, there are a few different paths that you can take:
- Generate an SQL script and execute it in your database
- Run the external dotnet migrate command from the terminal
- Add automatic migration capability to your application code.
All of the mentioned methods are good, but I will concentrate on the third option because it's the most developer-friendly and allows you to move fast as you add new features.
The DatabaseFacade object, held by the DbContext and exposed by the Database property, contains the Migrate method that runs the migration process ...