June 2017
Intermediate to advanced
1083 pages
22h 12m
English
Now that we have built our main entity skeleton we need to create some relationships between them. We want to be able to do stuff like retrieving an Item, browsing to their related Comments, then getting the ApplicationUser for each one of them, and also the other way around. We can easily do that by implementing a set of related entity properties: EF will load them on demand using its default lazy-load retrieval feature.
The first thing we'll do is to add a new region to our Item class, containing two new properties:
#region Related Properties /// <summary> /// Current Item's Author: this property will be loaded on first use using EF's Lazy-Loading feature. /// </summary> [ForeignKey("UserId")] public virtual ApplicationUser ...Read now
Unlock full access