EntityFramework.Docs icon indicating copy to clipboard operation
EntityFramework.Docs copied to clipboard

Need example of loading a single navigation property, not collection

Open rgamage opened this issue 6 years ago • 1 comments

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.

rgamage avatar Jan 28 '20 21:01 rgamage

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()

ghost avatar Jan 31 '20 15:01 ghost