Lazy vs. Eager vs. Explicit Loading in EF Core | Day 4 | By Pranaya Rout | Dot Net Core Tutorials

2K views Dec 8, 2023

Lazy vs. Eager vs. Explicit Loading in EF Core | Day 4 | By Pranaya Rout | Dot Net Core Tutorials Eager Loading in EF Core Eager loading is one of the approaches Entity Framework Core (EF Core) provides to load related data of an entity from the database. This approach fetches the related data as part of the initial query, resulting in the primary entity and its related data being retrieved in a single roundtrip to the database. Lazy Loading in Entity Framework Core Lazy Loading is a Process where Entity Framework Core loads the related entities on demand. That means the related entities or child entities are loaded only when it is being accessed for the first time. So, in simple words, we can say that Lazy loading delays the loading of related entities until you specifically request it. Explicit Loading in Entity Framework Core Even if Lazy Loading is disabled in Entity Framework Core, it is still possible to lazily load the related entities, but it must be done with an explicit call. Here, we need to explicitly call the Load() method to load the related entities. That means the EF Core’s Explicit Loading loads related data from the database separately by calling the Load() method. Text Document Links: Lazy Loading in Entity Framework Core: https://dotnettutorials.net/lesson/lazy-loading-in-entity-framework-core/ Eager Loading in Entity Framework Core: https://dotnettutorials.net/lesson/eager-loading-in-entity-framework-core/ Explicit Loading in Entity Framework Core: https://dotnettutorials.net/lesson/explicit-loading-in-entity-framework-core/ You can contact us for live training using the Mobile Number, WhatsApp Number, and Email ID below. Contact Number: 91 7021801173 WhatsApp Number: 91 7021801173 Email ID: onlinetraining@dotnettutorials.net

#Computer Education
#Education
#Reference
#Software