Try out EF Core 6 new features using our ASP.NET Core Web API. These are the following examples we showcase for EF Core in .NET 6.
When working with Entity Framework, we can use migrations to keep our SQL Server database schema in sync with the entitles and properties in our application. With .NET 6, rather than calling a PowerShell script to update the database, we can now create an executable. This allows us to run this executable as a step in our DevOps deployment pipeline.
Temporal tables were introduced in SQL Server 2016, and are designed to give a full history of changes for a table in the database. EF Core 6 adds support for temporal tables. Not only can we can create tables as temporal, but we can also query against them.
Pre-convention model configuration
When setting properties within our entities, we sometimes want to set properties with a convention. One example would be to set all strings to have a maximum character length of 300 characters, unless explicitly specified. With Entity Framework in .NET 6, we can now do this.
This is the software that will need to be installed onto your machine.
Get the application working
These are the steps to get the application working.
- Fill out the source code form. We will send you an email where you can download the source code.
You are now ready to go.
Set up the database
Downloading the source code will guide you to a GitHub repository. In there, there is a Database folder. The Database folder containers two files. RoundTheCode.EFCore.bacpac and RoundTheCodeEfCore.bak. You will need to use one of these files to import the database to your SQL Server database.
Open the project in Visual Studio
RoundTheCode.EFCore.sln in Visual Studio 2022 and have a look at how we have used the new EF Core features. In
appsettings.json, make sure that the connection string is correct.
When running the application, you can hit
Check out our video where we go ahead and try out these EF Core 6 new features:
In addition, you can read more about EF Core 6 new features and changes for .NET 6 and what to expect from them.