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 |
||
|
Integer number |
int |
||
|
Long integer number |
long |
||
|
Decimal number |
decimal |
||
|
Date |
DateTime |
||
|
Date and time |
DateTime |
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 |
||
|
Text |
string |
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 |
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 |
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 |
||
|
Content item asset |
ContentItemAssetMetadata |
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> |
Represents a collection of content items and pages referenced by a specific content type field. |
|
|
Media files (obsolete) |
IEnumerable<AssetRelatedItem> |
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> |
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> |
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> |
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 |
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> |
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> |
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> |
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.