- Home
- .NET code examples
- Automated SQL scripts using Entity Framework Core migrations
Automated SQL scripts using Entity Framework Core migrations
You can use Entity Framework Core migrations to automate SQL commands across all environments.
You can learn more about using migrations in EF Core, or watch the video:
Download the code example
You'll need to fill out the code example form. We will send you an email where you can download the code example.
Software
This is the software that will need to be installed onto your machine.
Visual Studio 2026. Version 18.0.0 or above. It will work with the free community version.
.NET 10 SDK. Version 10.0.0 or above.
The application
Inside RunMigrations/appsettings.Development.json, find ConnectionStrings > EFMigrationsDbContext and point the connection string to where you want your database to be created.
Open up RoundTheCode.EFCoreMigrations.slnx, and run the RunMigrations worker project. If the connection string is set up correctly, the worker project should create the database and run all the migrations inside the Migrations folder in the Infrastructure project.
Related code examples