Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
So far we have looked at accessing data for a single type of entity
and everything has been about Destinations. But if we were writing a real
application, we would probably want to know something about the Lodging that is available at each Destination. If we want to access the Lodgings associated with a Destination, that means working with related
data.
You’ll need to pull related data into memory so that we can look at it. There are three approaches you can use to load related data: lazily, eagerly, or explicitly. While they may achieve the same end result, there are some differences between each approach that can have a significant impact on performance. This isn’t a one-time decision either. Different approaches may be better at different times. This section will walk through the three available options and help you work out which one is best for you in different situations.