Skip to main content
You are viewing help content for a version that is no longer maintained/updated.
All docs
V22.1
  • ColumnAttribute Class

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

    Declaration

    ColumnAttribute = class(
        TCustomAttribute
    )

    Remarks

    Mark a field or a property with this attribute and pass the column’s name as a parameter. If no name is specified, the name of the field or property is used instead. The field’s prefix (‘F’ or ‘f’) is automatically removed.

    The following code example maps the FId and FName fields to the Id and FullName columns. Note that applying the ColumnAttribute to the Name property is equivalent to applying it to the FName field.

    uses
      ..., dxEMF.Core, dxEMF.Attributes;
    type
      [Entity]
      TPerson = class
      strict private
        [Column, Key]
        FId: Integer;
        FName: string;
        // ...
      public
        property Id: Integer read FId;
        [Column('FullName')]
        property Name: string read FName write FName;
        // ...
      end;
    

    Note

    A field or property that makes up a primary key requires adding the ColumnAttribute.

    Inheritance

    See Also