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.
Loading...
Related Quiz
- How does Entity Framework handle projection queries involving navigation properties?
- How are navigation properties used in LINQ to Entities queries?
- How does the Entity Framework handle model changes in a large database during migration?
- Describe a scenario where Entity Framework logging helped in resolving a concurrency issue.
- To handle cache invalidation in a scalable Entity Framework application, ________ patterns can be implemented.