Attributes

Table attributes

Attribute On Description
[Table.Name] Class Specifies the name of the table for a class

[Table.Name]

Usages:

  • [Table.Name]

Defines the name of the table for storing records of this type. If omitted the class name will be used.

Field attributes

Attribute On Description
[Column.Name] Field Specifies the name of the column a field should be mapped to
[Column.PrimaryKey] Field Defines a primary key field, optionally autoincremented
[Column.Size] Field The size (width) of a field in the database. Mostly used with string and decimal data types. The scale parameter is optional
[Column.LargeText] Field Marks the field as a large text field (blob text)
[Column.Indexed(...)] Field Creates an index for this field, optionally specifying the name of the index, the sort order and the position of the field within that index
[Column.Null] Field Specifies that a field should be nullable in the database
[Column.NotNull] Field Specifies that a field should not be nullable in the database
[Column.Ignore] Field Does not map the field to a database field
[Relation] Field Mark a field as a relation

[Column.Name]

Usages:

  • [Column.Name(columnName)]

Defines the name of the column in the database. If omitted, the field name will be used.


[Column.PrimaryKey]

Usages:

  • [Column.PrimaryKey]
  • [Column.PrimaryKey(AutoIncrement=true|false)]

Defines the primary key field for the class. When used with AutoIncrement=true, the primary key will be incremented for each inserted record in the database. AutoIncrement can be set to false to override behavior of the naming convention (see Naming Conventions)

More than one field can be marked as primary key. This will create a composite primary key for the table.

When any field in a class has this attribute, the automatic creation of a primary based on the naming convention will not applied.


[Column.Ignore]

Usages:

  • [Column.Ignore]

Tells Iridium not to map the field to a column in the database. By default, every writable public field and property is mapped to a database field. Fields and properties that are read-only are never mapped to a table column.


[Column.Indexed]

Usages:

  • [Column.Indexed]
  • [Column.Indexed(name)]

Creates an index for the marked field. If no options are given, an index for this field only is created.

Options:

  • IndexName : provides a name for the index. If more than one field shares the same index name, the fields will be combined in the same index, ordered by Position and sorted according to the Descending option.
  • Unique: if true, the index is a unique index (no duplicate values allowed)
  • Position: only used when multiple fields are defined with the same IndexName. Fields are added to the index in order of Position
  • Descending: if true, the index is sorted in descending order

When any field in a class has this attribute, automatic indexes based on the naming convention will not be added.


WORK IN PROGRESS - TO BE COMPLETED