ASP.NET Core 6.0 Web API with Entity Framework core and EF core Power Tools
In this tutorial, we will see how to start with ASP.NET Core web API with Entity Framework core.
I will use Visual Studio 2022 community edition in this tutorial and .NET 6.0 core, Entity Framework Core 6.0, and SQL Server 2019 community edition.
I will use Database First Approach, using an existing SQL database to scaffold the required entities. There are two ways to scaffold the SQL database.
- Using a visual studio extension — EF Core Power Tools (for various tools link is provided below in the description) and
- Reverse engineering — using commands in the package manager console.
A little brief about Entity Framework Core
Entity Framework is an ORM-Object-relational mapping framework that helps to represent the Database into the object-oriented programming model in the .NET Core ecosystem helping to interact and perform CRUD operation on relational DB without hassle. EFCore brings a higher level of abstraction and helps create data-oriented applications with less code and in an efficient way.
So let’s get started.
First, let’s install the EF Core power tools. Open the browser, search for EF Core power tools Marketplace, and click on the first link (or use this link: https://marketplace.visualstudio.com/items?). Download the extension ( this extension is for Visual Studio). Once…