juniorEntity Framework
What is the difference between Eager Loading and Lazy Loading?
Updated Apr 28, 2026
Short answer
Eager Loading fetches related data upfront using Include(). Lazy Loading fetches related data on-demand when accessed.
Deep explanation
Eager loading is explicit and generates SQL JOINs. Lazy loading generates a new query the moment a navigation property is accessed. Lazy loading requires the Proxies package and virtual properties, and can lead to performance issues (N+1 problem).
Real-world example
Loading a blog post along with all its comments in a single query to render a complete webpage quickly.
Common mistakes
- Relying heavily on lazy loading in a loop, causing hundreds of separate database queries (N+1 query problem).
Follow-up questions
- How do you enable Lazy Loading in EF Core?