8 References — lightweight pointers
A reference stores the id of another node on this node. It points one way: it is cheap to store and to set, and the target does not know about it.
| Type | Stores | Use for |
|---|---|---|
Reference<T> |
one Guid |
"the cover image of this event" |
References<T> |
an ordered Guid[], duplicates kept |
"the sponsors of this event, in billing order" |
public interface IEvent {
// ...
[ReferenceProperty(Indexed = true)] // Indexed = true is needed to filter or facet on it
Reference<IMediaAsset> Cover { get; }
[ReferencesProperty(Indexed = true)]
References<IOrganizer> Sponsors { get; }
}On a class, initialise them: public Reference<IMediaAsset> Cover { get; set; } = new();.
- Reading and writing a Reference<T>
- Reading and writing a References<T> — Get() skips stale targets, such as deleted nodes or nodes of the wrong type, instead of throwing.