Migrations and Seed Data in EF Core (New Updated Video in the Description)

Опубликовано: 07 Ноябрь 2024
на канале: Code Maze
25,722
350

►► Check out our courses: https://bit.ly/cdmz-courses
►► Support us on Patreon and get the source code:   / codemaze  

UPDATED VIDEO IS HERE:    • Entity Framework Core Code First Migr...  

In this video, we are going to learn how to create Migrations, seed data, and make automatic migrations with Entity Framework Core. Also, we will show you how to remove and script migration files.

LINKS MENTIONED IN THE VIDEO:
To visit the whole article and download the source code visit:
►► https://code-maze.com/migrations-and-...
To learn more about the EntityFramework Core, visit:
►► https://code-maze.com/entity-framewor...
To visit our site:
►► https://code-maze.com/

FOLLOW US ON SOCIAL MEDIA!
►►   / marinko-spasojevic  
►►   / codemazeblog  
►►   / codemazeblog  

VIDEO SUMMARY:
In this video, we are going to cover Migrations and Seed data features in Entity Framework Core.

Migration is a way to keep the database schema in sync with the Entity Framework Core model by preserving data.

The migration process has two steps: Creating migration and Applying migration. As we already said, our database schema must be aligned with the database model and every change in that model needs to be migrated to the database itself.

We have prepared a project with the database model containing entity and context classes and applied different configuration options. Additionally, we have installed the required libraries and registered ApplicationContext as a service in the Startup class. All of these are required to support DI Entity Framework Core usage in our application.

Entity Framework Core provides a method called Migrate to execute migration actions for us. So, with these preparations in place, all we have to do is create and execute migrations with a set of simple commands.