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.
Download this code example
Enter your email and we'll send you a download link.
Related code examples
Get started with EF Core includes creating a DbContext, adding a migration, CRUD operations, the Include method, raw SQL queries and stored procedures.
Download a .NET 10 sample project demonstrating Global Query Filters in Entity Framework Core, including soft delete and multitenancy, and run it in Visual Studio to see how they work in practice.
Download this code example
Enter your email and we'll send you a download link.