Skip to main content

IndexesAttribute Class

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

Declaration

IndexesAttribute = class(
    TCustomAttribute
)

Remarks

Unlike the IndexedAttribute, the IndexesAttribute applies to an entity class and allows you to create simple and multi-column indexes. To specify a multi-column index, pass two or more column names delimited by a comma or a semicolon. You can apply multiple IndexesAttributes to the same entity class – each of them creates a new index.

The following code uses the IndexesAttribute to create two indexes: a simple index on the Age column and a multi-column index on the FirstName and LastName columns mapped to corresponding fields.

uses
  ..., dxEMF.Core, dxEMF.Attributes;
type
  [Entity]
  [Automapping]
  [Indexes('Age')]
  [Indexes('FirstName,LastName')]
  TPerson = class
  strict private
    FId: Integer;
    FAge: Integer;
    FFirstName: string;
    FLastName: string;
  public
    // ...
  end;

Inheritance

TObject
TCustomAttribute
IndexesAttribute
See Also