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#.
What is an ORM?
Where are ORMs useful?
What is EF Core?
Introducing: the database context
How does a DbContext work?
The application we will build the data access for
Creating our first EFCore Model
Getting the Model to work in our application
Implementing data manipulation operations
Implementing query behavior
Seeing what goes on in the Database
Projecting data to optimize queries
Taking a look at the DB schema
Introducing DataAnnotations for our Model
Achieving similar results with FluentAPI
One-to-many relationships between entities
Converting between different data types
Using owned and complex types to group data
Generating values in the model
Hiding some database fields from our model
Applying global query filters
Why do we need migrations?
The 2 migration philosophies
Adding our first migration
Adding migrations after changing the model
Executing Migrations from the CLI
Dealing with an out-of-sync model
The proper way to execute migrations
What are the challenges in tests with ORMs?
Using Test databases
Using a database in memory
Faking DbSets in unit tests
The repository pattern
Integration testing with EF Core
More on repositories
Different multi-tenant approaches
Multi-tenant with discriminators
Multi-tenant with separate databases
My take on architecture
More DbContext features?
Using inheritance in your model
Using Alternate keys
Using compound keys
Using raw SQL queries for your entities
Using keyless entities to query your database
Using the ChangeTracker for fun & profit
The typical types of performance issues
Slow Queries & DB indices
Using compiled queries to improve runtime performance
Using batching to execute bulk queries
Loading related data - strategies
Untracked query results
Solving Concurrency Issues
When the DB already exists
Using the DB to generate a model
How can we further evolve the model?
Regenerating every time: a demo
Keeping in sync manually: a demo
EF Core isn't just for SQL server
Using another RDBMS's with EFCore
What is CosmosDB?
Switching our system to CosmosDB
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.More courses by Hannes Lowette