Skip to content

ReadRelationInstance

ReadRelationInstance<TItem> = ReadOneRelationInstance<TItem> | ReadManyRelationInstance<TItem>

Defined in: runtime/relation.ts:202

An instance of a relation - being accessing a relation from a “side” of the relation.

Relations are always accessed from an item. Then “other end” of the relation being accessed determines the direction. For example:

Employee 0..1 — assigned —> 0..1 Parking Space

employee.relations.assigned returns a OneRelationInstance where the source is the from-side “Employee” and target is the to-side “Parking Space”.

You can also access this relation in the reverse:

parkingSpace.relations.assigned returns a OneRelationInstance where the source is the to-side “Parking Space” and target is the from-side “Employee”.

Source indicates where the relation is being accessed (Employee and ParkingSpace in the respective examples above). The target is the other side of the relation (ParkingSpace and Employee, respectively).

TItem extends ReadItem = ReadItem