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) | Marks a class as an entity class. | |
Table and Column (Simplified Mapping) (applies to classes and fields/properties) | Enables simplified table and column mapping for an entity class. | |
Excludes a field from a schema created for an entity class marked with the Automapping attribute. | ||
Table (applies to classes) | Specifies a data store table to which an entity class maps its data. | |
Specifies the name of a database schema in which a table mapped to an entity class is created. | ||
Inheritance (applies to classes) | Specifies where an entity descendant class stores its data. | |
Specifies a discriminator column whose values identify rows that correspond to an entity class and its descendants in the class’s mapped table. | ||
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) | Specifies one or more table columns that make up a primary key for an entity class. | |
Specifies how an auto-incremented primary key generates its values. | ||
Column (applies to fields/properties) | Specifies a table column to which an entity class maps its field/property. | |
Specifies the data store type of a table column to which an entity class’s field/property maps its data. | ||
Allows a table column mapped to an entity class’s field/property storing NULL values. | ||
Reserved for future use. | ||
Specifies the size of a column to which a string or BLOB data field/property of an entity class is mapped. | ||
Indicates if a column to which a string or BLOB data field/property of an entity class is mapped stores Memo or BLOB data. | ||
Makes a TdxEMFDataSet component’s field bound to an entity class’s field/property read-only. | ||
Column Index (applies to classes) | 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) | 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. | |
Creates a unique index on a table column that is mapped to an entity class’s field/property. | ||
Relationship (applies to fields/properties) | Identifies the end of an association that establishes a one-to-many entity relationship. | |
Indicates if an entity class’s collection field/property referencing an association‘s “many” end aggregates its referenced entity objects. | ||
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.