Lazy Loading:- By Default Linq support lazy loading. in this techniq the Child objects are not loaded automatically with Parent object. until they are requested.var query = context.Employees.Take (4); // Lazy loading
Eager Loading:- in case of eager loading the child objects are loaded automatically with parent object.if we want to use eager loading then we need to use Inclue method.var query = context.Employees.Include(“Products”).Take(4); // Eager loading
Explicit Loading:- when lazy loading is turn off. we can also load related entites by explicit calling by load method.dbContext.Entry(usr).Reference(usr => usr.UserDetails).Load();
Eager Loading loads all entities at once .But for Lazy Loading child entity loaded when it is accessed. When you have turned off Lazy Loading, use Explicit loading when you are not sure whether or not you will be using an entity beforehand.