Which type of loading is good in which scenario?

Technology CommunityCategory: Entity FrameworkWhich type of loading is good in which scenario?
VietMX Staff asked 3 years ago
  • Use Eager Loading, when the relations are not too much so that we can get the data in one database query.
  • Use Eager Loading, if you are sure that we are going to use the dependent/related entities.
  • If there are one-to-many relations use Lazy loading and if the dependent/related entities are not required down the line.
  • When Lazy Loading is turned off, use Explicit loading when you are not sure whether dependent/related entities are not required down the line.