Relations in Fluent

Relations are a way to connect two different models. In object-oriented programming, relations help us architect a software solution by relating it to the real world. Similarly, we need to create relations in the database to model the way we write code in object-oriented programming languages. Luckily, most of the databases support relations and are often referred to as relational databases.

For example, we already have two models, one called ShoppingList and one called Item, that have a relation between each other in our iOS app. Each ShoppingList has many items and each Item belongs to a ShoppingList. These relations are represented in our code in the form of an array of Item objects, or as a reference variable pointing ...

Get Hands-On Full-Stack Development with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.