Another type of loading is explicit loading. It works like lazy loading, but you are in control of exactly which related data is loaded and when. You can think of lazy loading as explicit loading that happens automatically for all related entities.
In the QueryingCategories method, modify your query statements to prompt the user if they want to enable eager loading and explicit loading, as shown in the following code:
IQueryable<Category> cats; // = db.Categories;//.Include(c => c.Products); Write("Enable eager loading? (Y/N): "); bool eagerloading = (ReadKey().Key == ConsoleKey.Y); bool explicitloading = false; WriteLine(); if (eagerloading) { cats = db.Categories.Include(c => c.Products); } else { cats = db.Categories; ...