Relations

Lynicon like any CMS allows you to define that content items are related.  This is done in the same way as in a relational database, a field contains a reference to the id of another item.  When you set a content item property to the type Reference<T>, this has an editor rendered for it which is a drop down list of the titles of all content items whose type is assignable to T.  Reference<T> provides some useful properties and methods:


MemberDescription
.IsEmptyWhether there is any value in the reference
.Summary The summary of the item referred to (as a Summary)
.GetSummary<T>()Get the summary of the item referred to indicating what type you want it cast to
.ItemIdThe ItemId of the referenced item (null if nothing referenced)
.TypeThe content type of the referenced item
.IdThe id (identity) of the referenced item

Other reference types

Reference<T> inherits from non-generic Reference, which is essentially the same however it is a reference to any content item on the system.

ReferenceList<T> is a special content subtype for selecting multiple references.  This is rendered as an enhanced multi-select drop-down in the editor.  In code, this is simply a list of Reference<T>

CrossVersionReference<T> allows for references to be made to content items in a different version from the current item. Reference<T> can only reference items in the same version as the current content item, so this is necessary to bypass that.  It has a property .Version which returns an ItemVersion for the version in which the referenced item exists.  Also it has a property AllowedVersionsOverlay which lets you specify the set of versions which are accessible from the current version via the Mask operation.