Module 07 of 12

Data Access with EF Core

Lessons

About This Module

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.

Lessons

4 videos
01

Entity Framework Code First: DbContext and Migration

Builds a first EF Core setup from scratch: configuring a DbContext, creating an entity class, and connecting to SQL Server.

02

EF Core Migrations Explained in Depth

A tour of EF Core migrations, including Add-Migration, Update-Database, and Remove-Migration, for evolving your database schema alongside your model.

03

One-to-Many & Many-to-Many Relationships in EF Core

Explains the difference between one-to-many and many-to-many relationships and how to set each one up in Entity Framework Core.

04

EF Core N+1 Query Problem Explained

Demonstrates the N+1 query problem in Entity Framework Core and how it affects ASP.NET Core API performance in real-world applications.