EF Core Migration

EF Core Script Migration
Entity Framework Core

EF Core Script Migration

In this tutorial let us explore the script-migration in EF core to generate SQL Scripts. We can execute these SQL Scripts in the production server to bring the database in sync with the model. This is very useful when you do not have direct access to the production server. The script migration has a –idempotent option which ensures that you do not accidentally execute the script twice. This tutorial assumes that you know how to create EF Core console app and also know about EF Core migrations

Entity Framework Database First Reverse Engineer the Database
Entity Framework Core

EF Core Database First. Reverse Engineering the Database (scaffolding)

In this article, we will learn how to use Entity Framework Core with the existing database or Database First approach. The EF core only supports Code First & Database First approach. In Database First, We use the Scaffold-dbcontext to create the Model from an existing database. This is basically Reverse engineering the existing database. Once we create the entity classes, both approaches i.e. databases first & code the first approach works in the same way

Migration in Entity Framework Core
Entity Framework Core

EF Core Migrations

In this tutorial, we look at What is Entity Framework Migration is and how to create migrations. We will build a simple console application and create two models. We will use the add-migration command to create the migration and then use the update-database command to create the database. Next, we will update the model and create another migration and update the database. Then we will revert the migration from the database and remove the migration. Finally, we will also see how to generate SQL Scripts containing the migration commands

Scroll to Top