Skip to main content

Built-in Attributes

  • 3 minutes to read

The ExpressEntityMapping Framework uses built-in attributes and runtime type information (RTTI) to map entities defined in an entity model to data store objects. These attributes allow you to provide mapping details, establish relationships between entity classes, define entity inheritance, etc. Add the dxEMF.Attributes unit to the ‘uses’ clause to enable these attributes in your project.

The following table lists all built-in attributes by mapping category.

Mapping Category

Attribute

Description

Entity

(applies to classes)

Entity

Marks a class as an entity class.

Table and Column

(Simplified Mapping)

(applies to classes and fields/properties)

Automapping

Enables simplified table and column mapping for an entity class.

NonPersistent

Excludes a field from a schema created for an entity class marked with the Automapping attribute.

Table

(applies to classes)

Table

Specifies a data store table to which an entity class maps its data.

SchemaName

Specifies the name of a database schema in which a table mapped to an entity class is created.

Inheritance

(applies to classes)

Inheritance

Specifies where an entity descendant class stores its data.

DiscriminatorColumn

Specifies a discriminator column whose values identify rows that correspond to an entity class and its descendants in the class’s mapped table.

Discriminator

Specifies a discriminator column value that uniquely identifies rows that correspond to an entity class in the ancestor’s table.

Primary Key Column

(applies to fields/properties)

Key

Specifies one or more table columns that make up a primary key for an entity class.

Generator

Specifies how an auto-incremented primary key generates its values.

Column

(applies to fields/properties)

Column

Specifies a table column to which an entity class maps its field/property.

DBType

Specifies the data store type of a table column to which an entity class’s field/property maps its data.

Nullable

Allows a table column mapped to an entity class’s field/property storing NULL values.

Default

Reserved for future use.

Size

Specifies the size of a column to which a string or BLOB data field/property of an entity class is mapped.

Blob

Indicates if a column to which a string or BLOB data field/property of an entity class is mapped stores Memo or BLOB data.

ReadOnly

Makes a TdxEMFDataSet component’s field bound to an entity class’s field/property read-only.

Column Index

(applies to classes)

Indexes

Specifies one or more columns that make up a non-unique index on a data store table to which an entity class is mapped.

Column Index

(applies to fields/properties)

Indexed

Specifies if a field’s/property’s mapped column makes up a non-unique index on a data store table to which an entity class is mapped.

Unique

Creates a unique index on a table column that is mapped to an entity class’s field/property.

Relationship

(applies to fields/properties)

Association

Identifies the end of an association that establishes a one-to-many entity relationship.

Aggregated

Indicates if an entity class’s collection field/property referencing an association‘s “many” end aggregates its referenced entity objects.

NoForeignKey

Disables automatic creation of foreign key constraints for an association.

Refer to the descriptions of the attribute classes listed above for details and code examples on how to use them.