How can you implement explicit loading for a collection property in Entity Framework?

  • Load the collection property using Include method
  • Use the Load method on the navigation property
  • Set the LazyLoadingEnabled property to false
  • Use the Find method with an entity's primary key
Option 2 is correct. To explicitly load a collection property in Entity Framework, you can use the Load method on the navigation property. This method triggers the loading of the related entities for the specified navigation property. Using Include method is for eager loading, setting LazyLoadingEnabled to false disables lazy loading, and Find method loads a single entity by its primary key.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *