From Zero to Hero: Entity Framework Core in .NET

Learn how to use Entity Framework Core in your .NET applications

About This Course

Entity Framework (EF) Core is a lightweight, extensible, open source and cross-platform object-relational mapper or ORM which enables .NET developers to work with a database using .NET objects and eliminates the need for most of the data-access code that typically needs to be written. Alongside Dapper, it is one of the two most popular ORMs in .NET, and given how much its performance has been improved in the last few .NET versions, it is an excellent choice for any .NET application. In this 8-and-a-half-hour-long course, Hannes Lowette will cover everything you need to know about Entity Framework Core, from its most basic concepts to its most advanced ones, including testing and different database providers. This course is effectively two courses bundled as one, and it is the best resource you could have to learn Entity Framework code in .NET with C#.

Course Curriculum

8h 33m 12 sections
Welcome
00:34 Free preview
What will you learn in this course?
01:13 Free preview
Who is the course for?
01:25 Free preview
What is an ORM?
03:23
Where are ORMs useful?
02:29
What is EF Core?
05:16
Introducing: the database context
02:05
How does a DbContext work?
02:25
Section recap
00:36
The application we will build the data access for
06:32
Creating our first EFCore Model
04:07
Getting the Model to work in our application
10:59
Implementing data manipulation operations
17:43
Implementing query behavior
08:15
Seeing what goes on in the Database
04:08
Projecting data to optimize queries
04:04
Section recap
00:54
Taking a look at the DB schema
02:34
Introducing DataAnnotations for our Model
04:49
Achieving similar results with FluentAPI
09:42
One-to-many relationships between entities
14:22
Converting between different data types
12:08
Using owned and complex types to group data
10:03
Generating values in the model
09:00
Hiding some database fields from our model
04:09
Applying global query filters
03:28
Section recap
01:08
Why do we need migrations?
02:50
The 2 migration philosophies
06:00
Adding our first migration
08:47
Adding migrations after changing the model
07:15
Executing Migrations from the CLI
05:23
Dealing with an out-of-sync model
06:11
The proper way to execute migrations
06:38
Section recap
00:41
What are the challenges in tests with ORMs?
04:59
Using Test databases
05:17
Using a database in memory
13:29
Faking DbSets in unit tests
10:09
The repository pattern
08:49
Integration testing with EF Core
04:26
Section recap
03:32
Introduction
00:53
Dependency Injection
08:23
Configuring Logging
10:06
DbContext Lifecycle
07:46
More on repositories
17:06
Different multi-tenant approaches
04:00
Multi-tenant with discriminators
09:35
Multi-tenant with separate databases
04:59
My take on architecture
04:47
Section recap
00:52
More DbContext features?
01:27
Using inheritance in your model
27:26
Using Alternate keys
05:37
One-to-one relationships
05:39
Many-to-many relationships
09:30
Using compound keys
03:14
Using raw SQL queries for your entities
07:36
Using keyless entities to query your database
05:31
Using the ChangeTracker for fun & profit
12:56
Section recap
01:20
The typical types of performance issues
04:19
Slow Queries & DB indices
07:58
Using compiled queries to improve runtime performance
06:59
Using batching to execute bulk queries
08:38
Loading related data - strategies
15:40
Untracked query results
03:23
Solving Concurrency Issues
10:58
Section recap
01:07
When the DB already exists
00:26
Using the DB to generate a model
09:43
How can we further evolve the model?
05:57
Regenerating every time: a demo
04:54
Keeping in sync manually: a demo
04:58
Section recap
00:07
EF Core isn't just for SQL server
00:59
Using another RDBMS's with EFCore
10:18
What is CosmosDB?
06:36
Switching our system to CosmosDB
15:30
Section recap
01:09
Conclusion
00:44

Meet Your Instructor

Hannes Lowette

Hannes Lowette

With 20 years in .NET development, Hannes has always been passionate about performance, databases, distributed systems and large-scale applications. When it comes to architecture, his opinions have become a bit more nuanced, and the "it depends" card, however boring, gets played in many technical discussions. Hannes has always had a passion for sharing knowledge. It doesn't matter whether it is one-to-one while pair programming, on a conference stage giving a talk or when he's helping people succeed in their careers as a coach. In his free time, when he's not building LEGO® castles with his three kids, he likes to stream his guitar building on Twitch and spends too much time playing online chess and doing all-around geeky stuff. You can always lure him into a chat over a glass of great Whisky.

View all courses by Hannes Lowette

What's New

Getting Started: Building .NET Applications on AWS
course

Getting Started: Building .NET Applications on AWS

Learn how to build and deploy .NET applications on AWS using CDK, Lambda, DynamoDB, S3, and more.

Learn More
What's new in C# 14
blog

What's new in C# 14

This guide covers every new C# 14 feature, explains its benefits, and provides practical code examples to help you navigate how you can use them.

Learn More
Let's Build It: AI Chatbot with RAG in .NET Using Your Data
course

Let's Build It: AI Chatbot with RAG in .NET Using Your Data

Build a Retrieval-Augmented Generation (RAG) chatbot that can answer questions using your data.

Learn More
From Zero to Hero: SignalR in .NET
course

From Zero to Hero: SignalR in .NET

Enable enterprise-grade real-time communication for your web apps with SignalR.

Learn More
Deep Dive: Solution Architecture
course

Deep Dive: Solution Architecture

Master solution architecture and turn business needs into scalable, maintainable systems.

Learn More
Migrating: ASP.NET Web APIs to ASP.NET Core
course

Migrating: ASP.NET Web APIs to ASP.NET Core

A step-by-step process to migrate ASP.NET Web APIs from .NET Framework to ASP.NET Core.

Learn More
Getting Started: Caching in .NET
course

Getting Started: Caching in .NET

Let's make the hardest thing in programming easy for .NET software engineers.

Learn More
From Zero to Hero: Testing with xUnit in C#
course

From Zero to Hero: Testing with xUnit in C#

Learn how to test any codebase in .NET with the latest version of xUnit, the industry-standard testing library.

Learn More
Create a ChatGPT Console AI Chatbot in C#
blog

Create a ChatGPT Console AI Chatbot in C#

This walkthrough is your hands-on entry point to create a basic C# console application that talks to ChatGPT using the OpenAI API.

Learn More