dotnet / dotnet/EntityFramework.Docs

UUF ported issue: Clarify EF Core Lazy loading

Open
#4,966 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Mermaid
Stars
1.7k
Forks
2k
Avg merge
7d 23h
Merged PRs (30d)
16

Description

### Type of issue

Typo

### Description

The following is customer feedback filed as an Issue in UUF from ADO that has been ported to here:

The following text from this topic could use some clarification:

"EF Core will then enable lazy loading for any navigation property that can be overridden--that is, it must be virtual and on a class that can be inherited from."

This implies that navigation properties need to be virtual for lazy loading to work when using UseLazyLoadingProxies. However, it does not explicitly state that all navigation properties must be marked as virtual when using this method, which can lead to confusion.

The text here is unclear.It is implied that navigation properties need not be virtual, and that lazy-loading will only apply to virtual navigation properties. However, it seems that calls to "UseLazyLoadingProxies" means that all navigation properties MUST be marked virtual. This is not clearly stated in the document.

### Page URL

https://learn.microsoft.com/en-us/ef/core/querying/related-data/lazy

### Content source URL

https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/querying/related-data/lazy.md

### Document Version Independent Id

7c665098-afcc-1ba0-d6a2-0262ae921575

### Article author

@roji

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.