Say I have a role entity and a site entity. Now there are many roles to one site, so on the Role class there is a Site property that represents that relationship. If I wanted the roles for a site I would do this:
Site.Roles.Load()
Problems is, since the Site property on the Role class isn’t a collection but just a single entity, there is no Load method:
currentRole.Site //????
So that when a role is loaded, the Site is null and there is no way to get the site other than say a query on the role collection to get the SiteID, getting the Site from the site collection, and finally setting that to currentRole’s site property.
There has to be a better way? Do I have to force some kind of join in the query? Seems like this would be generated by code just like the Load method behaves.
Accessing it will load it. If you want it to load it explicitly there should be an .Include() method on the object query.
Here’s some documentation