Difference between Lazy Loading and Eager Loading in Entity Framework Core

Sdílet
Vložit
  • čas přidán 15. 10. 2020
  • Previous video Link (Part 9) • Lazy Loading in Entity...
    From this video you will Learn the differences between Lazy Loading, Explicit Loading and Eager Loading in EF Core.
    EntityFrameworkCore supports three types of loading method to populate the child entities. They are Eager Loading, Explicit Loading and Lazy Loading.
    Eager loading creates single query using SQL Joins to fetch the Parent with referenced child entities. Eager Loading fetches the required data in a single SQL trip from the database server.
    Explicit Loading loads only the parent entity and we need to explicitly load the referenced entities separately.
    In Explicit loading, Every referenced or collection entities requires a separate SQL query to load the entities from the database.
    Lazy loading loads only the parent entity first and loads the related data when it is accessed by the property accessor.
    Lazy and explicit loading passes multiple SQL Queries to the database.
    Explicit loading is not suitable if you are populating a large no of Entities in a loop. Because it may results in sending multiple SQL queries
    to the database. it is best to use Eager Loading on that case.
    And much more in this video, please watch it to learn more.....

Komentáře • 8