Data types

All data types assignable via the field editor must be explicitly registered. The system uses the metadata provided during registration to:

  • Generate the database columns storing the values of individual fields
  • Configure code generator and field editor behavior
  • Perform value conversions (and object mapping for complex types) when transferring data to and from the database

Not every data type is offered everywhere. Each data type declares the kinds of objects whose fields can use it, so the set of options in the field editor differs between content types, reusable field schemas, system tables, and custom module classes. For details, see Data type configuration.

The following table highlights important data types registered by default:

Field editor name

C# data type

Database representation

Notes

Boolean (Yes/No)

bool

bit

Integer number

int

int

Long integer number

long

bigint

Decimal number

decimal

decimal

Date

DateTime

date

Date and time

DateTime

datetime2

Time values are stored in the time zone of the server where the application is running. However, the administration UI automatically converts and displays time in the local time zone of each user, based on browser and environment settings.

Time interval

TimeSpan

time

Text

string

nvarchar

This data type is not intended to store rich text content (formatted text that includes links, e.g., created using the rich text editor) – use the Rich text (HTML) data type instead. Database field length is configurable when creating or editing fields (up to the database maximum).

Long text

string

nvarchar(max)

This data type is not intended to store rich text content (formatted text that includes links, e.g., created using the rich text editor) – use the Rich text (HTML) data type instead.

Rich text (HTML)

string

nvarchar(max)

Represents rich text content created with the rich text editor. This data type also ensures that usage of content items is tracked correctly.

Unique identifier (GUID)

Guid

uniqueidentifier

Content item asset

ContentItemAssetMetadata

nvarchar(max)

Binary data attached to a content item.

This data type is only available in fields of reusable content types.

Pages and reusable content

IEnumerable<ContentItemReference>

nvarchar(max)

Represents a collection of content items and pages referenced by a specific content type field.

Media files (obsolete)

IEnumerable<AssetRelatedItem>

nvarchar(max)

Represents a collection of media files. This data type has been sunset along with media libraries and will soon be removed. See Media library migration.

Emails

IEnumerable<EmailRelatedItem>

nvarchar(max)

Represents a collection of emails from an email channel, referenced by a specific field. For example, chosen by the email selector component.

This data type is only available in fields of system tables and custom module classes.

Pages

IEnumerable<WebPageRelatedItem>

nvarchar(max)

Represents a collection of pages from the content tree of a selected website channel. For example, chosen by the page selector component.

Headless items

IEnumerable<HeadlessItemReference>

nvarchar(max)

Represents a collection of headless items from a headless channel. For example, chosen by the headless item selector component.

This data type is only available in fields of headless content types.

Smart folder

SmartFolderReference

uniqueidentifier

Represents a smart folder selected via the Smart folder selector component.

This data type is only available in fields of reusable and website content types, and in fields of reusable field schemas.

Taxonomy

IEnumerable<TagReference>

nvarchar(max)

Represents a collection of tags selected via the tag selector component.

This data type is only available in fields of content types and reusable field schemas.

Object code names

IEnumerable<string>

nvarchar(max)

Represents a collection of object code names selected via the object code name selector component.

This data type is not available in fields of headless content types.

Object global identifiers

IEnumerable<Guid>

nvarchar(max)

Represents a collection of object GUIDs selected via the object guid selector component.

This data type is not available in fields of headless content types.

No referential integrity for linked objects

The system doesn’t maintain the referential integrity of objects linked via the Pages and reusable content, Media files, Emails, Pages, and Object code names data types. Custom code must account for the referenced objects no longer existing or being otherwise invalid.

Extend the default set of data types

When none of the default data types fits the data you need to store, you can register your own. A custom data type declares its own C# type, database representation, and conversion functions, and becomes assignable via the field editor like any built-in type. See Add custom data types.