Junior EF Core

What is explicit loading?

When & how to use it?

Explicit loading means loading related data manually, after the main entity is loaded.

Use when:

  • You need full control over what and when to load
  • You don’t want automatic lazy loading

Example:

var blog = context.Blogs.First();

context.Entry(blog)

.Collection(b => b.Posts)

.Load();

context.Entry(blog)

.Reference(b => b.Owner)

.Load();

✅ Use .Reference().Load() for single navigation

✅ Use .Collection().Load() for collections

More from Entity Framework Core Tutorial

All questions for this course