Content type attributes

Use SerializableAttribute

All content types and subtypes (and enums used in these) must be marked with the SerializableAttribute so that they can be stored in binary files.

Lynicon provides various attributes to use on types defined for content persistence.

SummaryType(summaryType)Indicates the supplied type is the summary type for this content type
Summary([propertyName])Indicates this property maps to the property of the supplied name on the Summary type (or if no name is supplied, the one with the same name)
AddressComponent([routeKey, ConversionFormat=,UsePath=])Indicates this property is mapped directly to a url element of the url which is the item's main address.  This is more commonly used with basic persistence, but it can be used with content persistence too.  The url element must be specified in the url of the data route for this item.  The name of the element (which will be written{name} in the url) is by default the name of the property.  It can be set with the routeKey argument.  Also, a conversion format can be specified from the value of the field to the url string (e.g. '0000' would ensure an integer value had at least 4 dps with leading zeros in the url string).  If UsePath is set to true, the path string is stored in this field.
DisplayBlock(title, order)Indicates which display block this field should be displayed in and indicates the title of the block, together with its order - its position in the list of blocks.  Note that properties without an order value given will be displayed at the end of the list
JsonIgnore()The property will not be persisted (because content persistence uses Json serialization)
NonComposite()On a class, indicates that a composite shouldn't ever be made for this class.  On a property, indicates that it should be omitted from the composite class.  See Extend a Type for details of how composite types work.
RedirectPropertySource(PropertyPath, [SourceDescriptor], [ReadOnly])

Allows the collator to take values from other content items and preassign them to properties in this content item, then assign them back to their source when the items is saved.  PropertyPath is a comma separated list of property names. If just this value is set, these properties are sourced from a special null-addressed content item.  The effect of this is that the value of these properties are shared across all the items of a given type.

SourceDescriptor if supplied is a transformation of the path of the content item by splitting it into its element then supplying these as sequential arguments for a format string.

ReadOnly if set to true protects the source record from having changed values written to it.

See Sharing and Combining Content Data

ScaffoldColumn(false)Indicates that the property should not be editable through the content editor
SwitchableIcon(IconName, [XOffset], [YOffset], [HoverText])When used on an inheritor from Switchable type, indicates what icon should be used for switching between the selected property.  IconName indicates the filename in /Content/Icons/*.png to use.  If this is a sprite, XOffset and YOffset  lets you offset to the appropriate area of the sprite.  HoverText is the title attribute which appears when the mouse hovers over the icon.