Entity Framework Core is a library that allows us to access the database from our applications. It is designed as an object-relational mapper (ORM) and it works by mapping the relational database to the applications database model.
EF Core is a cross-platform library and it runs on Windows as well as on Linux. It was introduced with the .NET Core framework thus the “Core” part in its name to distinguish it from the .NET Framework version.
In this series, we are going to cover various topics related to EF Core and its relation with ASP.NET Core. We will show you how to create a basic configuration, how to use models and context classes, and how to use different configuration styles. Furthermore, we are going to learn about migrations, relationships in EF Core, querying the database and modifying the database content.
Of course, this is just an overview of this series. With each article and with each section of that article, we will go in detail through the examples and explanations.
For this tutorial, we recommend having:
- An ASP.NET Core knowledge – If you are not familiar with it, we have a great tutorial on that topic
- Knowledge of SQL
- A LINQ basic knowledge
- Visual Studio 2019 installed (preferred) or at least VS 2017
We are going to separate this tutorial into several parts:
- Getting Started with Entity Framework Core in ASP.NET Core – Entities, DbContext, Configuration
- Configuring Nonrelational Properties in EF Core
- Migrations and Seeding Data with Entity Framework Core in ASP.NET Core
- Entity Framework Core Relationships – Convention, Data Annotations and Fluent API
- Querying the Database with EntityFrameworkCore in ASP.NET Core
- Modifying Database – Insert, Update and Delete with Entity Framework Core
As a result of going through these articles, you should have a great understanding of using EF Core in your applications. Therefore, using migrations, creating configuration or writing optimized queries will be no problem at all.
So, let’s get going.