Class Attribute Reference
This page is a full reference for the class-level attributes available in Cognibase.
Attribute Hierarchy
SecurityObjectAttribute
└── RuntimeClassAttribute [RuntimeClass]
└── PersistedClassAttribute [PersistedClass]
PersistedClassAttribute inherits all options from RuntimeClassAttribute, which in turn inherits security options from SecurityObjectAttribute.
[PersistedClass]
Applied to classes that are saved to the database and synchronized across all nodes.
[PersistedClass]
public class Order : DataItem { ... }
Persistence Options
| Option | Type | Default | Description |
|---|---|---|---|
PersistedAs | string | (class name) | Override the database table name |
IsArchivable | bool | false | Enables the archival workflow for instances of this class |
IsClientPreLoaded | bool | false | Instructs the Client Object Manager to load all instances of this class automatically on startup |
IsServerPreLoaded | bool | false | Instructs the Server Object Manager to load all instances of this class automatically on startup |
TrackExactRefByChanges | bool | false | Enables precise tracking of reverse references |
IdPersistenceMode | DataItemIdPersistenceMode | Default | Controls how this class's identity key is stored |
Example — Class with Storage Options
// Loaded on both client and server at startup; stored in a custom table name
[PersistedClass(
PersistedAs = "tbl_screen",
IsClientPreLoaded = true,
IsServerPreLoaded = true)]
public class Screen : DataItem
{
[PersistedProperty(IdOrder = 1, AutoValue = AutoValue.Identity)]
public long Id { get => getter<long>(); set => setter(value); }
[PersistedProperty(IsMandatory = true)]
public string HostAddress { get => getter<string>(); set => setter(value); }
[PersistedProperty]
public int Width { get => getter<int>(); set => setter(value); }
[PersistedProperty]
public int Height { get => getter<int>(); set => setter(value); }
}
[RuntimeClass]
Applied to classes that are synchronized across all nodes but are never saved to the database, as they are only in-memory stored.
[RuntimeClass]
public class LiveAlert : DataItem { ... }
[PersistedClass] inherits all options listed below, so these apply to both attribute types.
Behaviour Options
| Option | Type | Default | Description |
|---|---|---|---|
IsTemplate | bool | false | Marks the class as a template — not directly instantiated |
Description | string | "" | Human-readable description of the class |
IsClientCached | bool | false | Cache instances on the client |
IsServerCached | bool | false | Cache instances on the server |
IsNotifyingReferrersOnChange | bool | false | When a property changes, notify all objects that hold a reference to this object |
HasRuleViolations | bool | true | Enables the rule-violation framework for this class |
IsSafeInsert | bool | true | Use safe-insert semantics when creating new instances |
Display and Binding Options
| Option | Type | Default | Description |
|---|---|---|---|
ClassDisplayMode | DeclarativePropertyDisplayMode | ScalarAndReferences | Controls which properties are surfaced in auto-generated UI |
ClassBindMode | DeclarativePropertyBindMode | ScalarAndReferences | Controls which properties participate in auto data-binding |
SignatureMode | SignatureMode | Default | How the object's signature string is composed |
SignaturePrefix | string | null | Prefix added before the signature string |
SignatureSuffix | string | null | Suffix added after the signature string |
SignatureSeparator | string | null | Separator used between signature components |
DisplaySettingsHandlerMethodName | string | null | Name of the method that returns display settings for this object |
Collision and Change-Stream Options
| Option | Type | Default | Description |
|---|---|---|---|
ReferenceByHandlingMode | ReferenceByHandlingMode | Delegate | How reference-by relationships are handled |
ChangeStreamMode | ChangeStreamMode | Delegate | Streaming behaviour for change events |
CollisionClientHandlingMode | CollisionClientHandlingMode | Delegate | How the client resolves concurrent edit collisions |
CollisionServerHandlingMode | CollisionServerHandlingMode | Delegate | How the server resolves concurrent edit collisions |
Field Load Error Options
| Option | Type | Default | Description |
|---|---|---|---|
FieldLoadErrorMonitorMode | FieldLoadErrorMonitorMode | On | Whether field-load errors are monitored |
FieldLoadErrorReportMode | FieldLoadErrorReportMode | Delegate | How field-load errors are reported |
FieldLoadErrorValueDeliveryMode | FieldLoadErrorValueDeliveryMode | Delegate | What value is delivered when a field-load error occurs |
FieldLoadAgingMode | FieldLoadAgingMode | Delegate | How field aging is applied on this class |
FieldLoadAgingDelay | string | "" | Delay duration for field aging |
Security Options (inherited from SecurityObjectAttribute)
| Option | Type | Default | Description |
|---|---|---|---|
SecurityEnabled | bool | true | Whether security checks are evaluated for this class |
SecurityLabel | string | "" | Label shown for this object in security management UI |
SecurityHeader | string | "" | Column header shown in security lists |
SecurityDescription | string | "" | Description shown in security management UI |
SecurityDisplayOrder | int | 0 | Sort order in security management lists |
Per-operation security defaults (all bool, all default true):
SecurityDefaultLoadAllowSecurityDefaultBrowseAllowSecurityDefaultDisplayAllowSecurityDefaultSaveNewAllowSecurityDefaultSaveUpdatedAllowSecurityDefaultSaveDeletedAllowSecurityDefaultSaveArchivedAllowSecurityDefaultFieldDisplayAllowSecurityDefaultFieldChangeAllowSecurityDefaultActionExecuteAllowSecurityDefaultDataLoadAllowSecurityDefaultDataBrowseAllowSecurityDefaultDataDisplayAllow
Example — Runtime Class with Security
[RuntimeClass(
Description = "Live operational status of a display screen",
IsClientCached = true,
SecurityOnFields = true,
SecurityDefaultFieldChangeAllow = false)] // fields are read-only by default
public class ScreenStatus : DataItem
{
[RuntimeProperty]
public bool IsOnline { get => getter<bool>(); set => setter(value); }
[RuntimeProperty]
public string ActiveContentName { get => getter<string>(); set => setter(value); }
[RuntimeProperty]
public DateTime LastHeartbeat { get => getter<DateTime>(); set => setter(value); }
}
Abstract Classes
You can mark any DataItem subclass as abstract. The class still carries [PersistedClass] or [RuntimeClass], but cannot be instantiated directly. Concrete subclasses inherit all annotated properties:
// Abstract base — defines shared structure
[PersistedClass]
public abstract class MediaFile : DataItem
{
[PersistedProperty(IdOrder = 1, AutoValue = AutoValue.Identity)]
public long Id { get => getter<long>(); set => setter(value); }
[PersistedProperty(IsMandatory = true)]
public string FileName { get => getter<string>(); set => setter(value); }
[PersistedProperty]
public long FileSizeBytes { get => getter<long>(); set => setter(value); }
}
// Concrete subclass — adds image-specific fields
[PersistedClass]
public class ImageFile : MediaFile
{
[PersistedProperty]
public int PixelWidth { get => getter<int>(); set => setter(value); }
[PersistedProperty]
public int PixelHeight { get => getter<int>(); set => setter(value); }
[PersistedProperty]
public ImageBLOB Thumbnail { get => getter<ImageBLOB>(); set => setter(value); }
}
// Concrete subclass — adds video-specific fields
[PersistedClass]
public class VideoFile : MediaFile
{
[PersistedProperty]
public TimeSpan Duration { get => getter<TimeSpan>(); set => setter(value); }
[PersistedProperty]
public BLOB Data { get => getter<BLOB>(); set => setter(value); }
}
A property typed as MediaFile can hold a reference to an ImageFile or a VideoFile instance:
[PersistedClass]
public class PlaylistItem : DataItem
{
[PersistedProperty(IdOrder = 1, AutoValue = AutoValue.Identity)]
public long Id { get => getter<long>(); set => setter(value); }
// Can reference any concrete MediaFile subtype
[PersistedProperty(IsMandatory = true)]
public MediaFile File { get => getter<MediaFile>(); set => setter(value); }
}
Non-Compressible Classes
By default, Cognibase may compress object payloads during network transfer. To opt a class out of compression — for example because it already stores compressed binary data — apply [NonCompressible]:
[NonCompressible]
[PersistedClass]
public class VideoClipFile : MediaFile
{
[PersistedProperty]
public BLOB CompressedData { get => getter<BLOB>(); set => setter(value); }
}
Custom Persistence Provider
If you need to override how a class's data is stored and retrieved (e.g. to map it against a legacy schema or an external API), implement ICustomPersistenceProvider and attach it with [PersistWith]:
[PersistWith(PersistenceProviderType = typeof(LegacyOrderPersistenceProvider))]
[PersistedClass]
public class LegacyOrder : DataItem
{
[PersistedProperty(IdOrder = 1)]
public string OrderNumber { get => getter<string>(); set => setter(value); }
// ...
}