You’re Using EF Core Wrong (And It’s Slowing You Down)
Автор: Milan Jovanović
Загружено: 2025-12-26
Просмотров: 10880
Want to master Clean Architecture? Go here: https://bit.ly/3PupkOJ
Want to unlock Modular Monoliths? Go here: https://bit.ly/3SXlzSt
🚀 Want a real performance boost in EF Core?
A common API pattern is loading multiple independent datasets in a single request (think dashboards: users + orders + logs). The naïve approach runs queries sequentially… and your latency adds up fast.
So you try Task.WhenAll — and EF Core throws the classic error:
“A second operation was started on this context…”
In this video, I’ll show you the right way to execute EF Core queries concurrently without crashing your app.
What you’ll learn
Why DbContext can’t run concurrent operations (even with async/await)
The dashboard scenario where parallel queries make a big difference
How to use IDbContextFactory to create a separate DbContext per query
A clean helper pattern to keep query code reusable
How to verify concurrency with tracing + measure the win
Tradeoffs to consider (more contexts, more connections)
DbContext is Not Thread-Safe: Parallelizing EF Core Queries the Right Way
https://www.milanjovanovic.tech/blog/...
Check out my courses:
https://www.milanjovanovic.tech/courses
Read my Blog here:
https://www.milanjovanovic.tech/blog
Join my weekly .NET newsletter:
https://www.milanjovanovic.tech
Chapters
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: