How to Add the Entity framework for SQL to a C# .NET 6.0 API
Make your life easier by using entity to interact with a SQL database.
In this article we will learn how to use a SQL database via Entity with our .NET API. In a previous article we learned how to create a brand new C# .NET 6.0 API. This tutorial will follow on from this using the same API code base. If you didn’t follow the previous tutorial, feel free to clone the following repo and checkout the Part_1_How_to_create_a_Dot_Net_6.0_CRUD_API branch.
However, if you have your own .NET API but wish to add Entity then still follow along and apply the same steps to your own API.
So what is Entity?
In the words of Microsoft themselves.
“Entity Framework Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations. EF Core works with many databases, including SQL Database (on-premises and Azure), SQLite, MySQL, PostgreSQL, and Azure Cosmos DB.”