EntityFramework.Docs
EntityFramework.Docs copied to clipboard
Need example of loading a single navigation property, not collection
The example of loading a collection after getting and inital object is great (Querying Related Entities), but what if you want a related single object, not a collection? I can't figure out the syntax for that case.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: bbd36f35-e257-d0ed-8f28-f539ddcb71ec
- Version Independent ID: 093903d5-f7c7-5a78-c0e5-0e2662dcedef
- Content: Loading Related Data - EF Core
- Content Source: entity-framework/core/querying/related-data.md
- Product: entity-framework
- Technology: entity-framework-core
- GitHub Login: @rowanmiller
- Microsoft Alias: avickers
Agree, It should be added to the documentation. In case you still need it it's like this:
context.Entry(blog).Reference(p => p.SingleNavigationPropertyOfBlog).Load()