Almost every real application needs to store data. Entity Framework Core is the standard ORM for ASP.NET Core: you describe your data as C# classes, and EF Core maps them to tables, generates the SQL, and tracks changes for you. Used well it removes a lot of boilerplate; used carelessly it can quietly generate slow queries.
This module starts with the code-first workflow: setting up a
DbContext, defining entities, and connecting to SQL Server. It then
covers migrations for evolving your schema safely, how to model
relationships (one-to-many and many-to-many), and finishes with the
N+1 query problem and other habits that keep your queries fast.
Watch the lessons in order, then continue on to Building REST APIs.
Builds a first EF Core setup from scratch: configuring a DbContext, creating an entity class, and connecting to SQL Server.
A tour of EF Core migrations, including Add-Migration, Update-Database, and Remove-Migration, for evolving your database schema alongside your model.
Explains the difference between one-to-many and many-to-many relationships and how to set each one up in Entity Framework Core.
Demonstrates the N+1 query problem in Entity Framework Core and how it affects ASP.NET Core API performance in real-world applications.