ASP.NET Core and EF Core 9.0 - Sample project Step-by-step guide to create an application from scratch with ASP.NET Core and Entity Framework Core 9 in just a few simple steps

ASP.NET Core e Entity Framework Core 9.0 - Progetto di esempio

We created this guide to help new developers and experienced professionals familiarize themselves with the capabilities offered by ASP.NET Core and Entity Framework Core 9. This article includes a practical and detailed demo project designed to explore the new features introduced in these technologies, providing a useful and concrete reference for real applications.

With the release of Entity Framework Core 9, the framework introduces significant improvements, including support for primitive collections, optimized query performance, and smoother integration with the .NET 9 runtime. These important innovations further consolidate the prominence of ASP.NET Core, which even in 2025, presents itself as an ideal framework for developing robust and flexible web applications: our sample application illustrates how to best combine its capabilities with the new features of EF Core 9.

The guide is designed to be accessible both to beginners who want to discover these technologies for the first time, and to experienced developers who want to update their skills or better understand the new features of this version. By following this article, you will be able to create a complete application, understand how to configure a project, and make the most of the innovations in ASP.NET Core and Entity Framework Core 9.

For more information on the main features introduced by Entity Framework Core 9, check out our dedicated article!

In the sections of this article, we will develop a complete example of a trial application using ASP.NET Core 9 and Entity Framework 9, including context configuration, model creation, CRUD operations (Create, Read, Update, Delete), and a simple web interface to interact with the database.

1: Create a new ASP.NET Core project

Open the terminal and use the following command to create a new ASP.NET Core project:

2: Add Entity Framework Core

Install the necessary packages for Entity Framework Core using the command:

3: Create the model and context

Create a folder called Models and add a Product.cs class and an AppDbContext.cs class.

Step 4: Configure the database in the appsettings.json file

Add the connection string for your SQL Server database in the appsettings.json file.

Step 5: Register the DbContext in Program.cs

Register the DbContext in the Program.cs file as follows:

Step 6: Create a Controller

Create a folder called Controllers and add a ProductsController.cs controller.

Step 7: Create the views

Create a folder called Views/Products and add the following views:

Index.cshtml

Create.cshtml

Edit.cshtml

Delete.cshtml

Step 8: Create the database

Run the migrations to create the database using the following commands:

Step 9: Run the application

Finally, run the application with the command:

Visit https://localhost:5001/Products in your browser to see the app in action.

Conclusion

This project demonstrates the main features of Entity Framework Core 9.0, including CRUD operations and integration with an ASP.NET Core application. Make sure you have SQL Server running and properly configured to test the project.

 

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.