When using lazy loading, what must be ensured for the navigation properties in the entity classes?

  • They must be marked as eager
  • They must be marked as lazy
  • They must be static
  • They must be virtual
When using lazy loading in Entity Framework, the navigation properties in the entity classes must be marked as virtual. This allows Entity Framework to override them and provide lazy loading functionality, where related entities are loaded from the database only when accessed. If the properties are not virtual, lazy loading will not work as expected.
Add your answer
Loading...

Leave a comment

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