Why is TColumnProp.Required on so many fields?

I see many of the fields have this tagged in the Entities for XData, on the server. But not all.

I can see why any fields that are part of an index may have them. But its on too many unexpected fields. It is even on fields it should not be on. Such as

  • Ref (Id) which is an autoincrement field and should not be populated.
  • Created and Modified which are automatically populated by the database (because of their definitions).

I know I can remove the tag. I was just wondering about the logic behind it, in case I should consider that in my decision.

Example

[Entity]
  [Table('registrations')]
  [Id('FRef', TIdGenerator.IdentityOrSequence)]
  Tregistrations = class
  private
    [Column('Ref', [TColumnProp.Required, TColumnProp.NoInsert, TColumnProp.NoUpdate])]
    FRef: Int64;

    [Column('Reg_Type', [TColumnProp.Required, TColumnProp.NoInsert, TColumnProp.NoUpdate])]
    FReg_Type: String;

    [Column('Platform', [TColumnProp.Required], 40)]
    FPlatform: string;

    [Column('Browser', [TColumnProp.Required], 40)]
    FBrowser: string;

    [Column('Email', [TColumnProp.Required], 80)]
    FEmail: string;

    [Column('Device_Name', [TColumnProp.Required], 80)]
    FDevice_Name: string;

    [Column('Fingerprint', [], 80)]
    FFingerprint: Nullable<string>;

    [Column('Created', [TColumnProp.Required])]
    FCreated: TDateTime;

    [Column('Modified', [TColumnProp.Required])]
    FModified: TDateTime;

    [Column('Created_By', [TColumnProp.Required])]
    FCreated_By: Int64;

    [Column('Modified_By', [TColumnProp.Required])]
    FModified_By: Int64;

Those are Aurelius mapping attributes, which is how the class is mapped to the database. It's database information.

Hence, TColumnProp.Required means the field will be required in database - i.e., NOT NULL.

In some cases there are default values, so I don't need the user hassled that they have not entered a value.

I am also puzzled by NoInsert, NoUpdate.

[Entity]
  [Table('bookings')]
  [Id('FRef', TIdGenerator.IdentityOrSequence)]
  Tbookings = class
  private
    [Column('Ref', [TColumnProp.Required, TColumnProp.NoInsert, TColumnProp.NoUpdate])]
    FRef: Int64;
    
    [Column('Status', [TColumnProp.Required, TColumnProp.NoInsert, TColumnProp.NoUpdate])]
    FStatus: string;
    
    [Column('Client_Ref', [TColumnProp.Required])]
    FClient_Ref: Int64;

These are appropriate for the Ref field as its Autoincrement. Even then, I find it useful during maintenance to be able to change the Ref number.

But they are not appropriate for the Status field

Again, this is not user related. This is database information indicating the database field is NOT NULL.

This is by default for generated identity fields. You can always change it, either manually or automatically using Data Modeler scripts, examples: