Junior From PDF EF Core Entity Framework Core

What is lazy loading? How to enable lazy loading in EF Core? What

re proxies?

Lazy loading delays the loading of related data until it's accessed for the first time.

EF Core requires proxies for lazy loading:

Install NuGet:

Microsoft.EntityFrameworkCore.Proxies

  • Enable in OnConfiguring or AddDbContext:

options.UseLazyLoadingProxies();

  • Mark navigation properties as virtual:
public virtual ICollection<Post> Posts { get; set; }
  • EF creates runtime proxies to override navigation properties and load them when

ccessed.

More from Entity Framework Core Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details