Skip to content

Primer Demo: The Business Model ​

The contact book featured in this application is based on a simple business model of contact related information. The following UML class diagram shows how this information is organized.

The business model was implemented entirely in the Delphi IDE using the integrated InstantObjects Model Explorer.

Time stamp of the contacts ​

Since 4.4.0 TContact has the read-only attribute ObjectTimeStamp, of the TimeStamp type: it holds the moment when the contact (person or company) has been stored the last time, when it is created or changed. The value is set by the business object in BeforeStore, so the property has no setter:

pascal
TContact = class(TInstantObject)
{IOMETADATA stored;
  ...
  Phones: Parts(TPhone);
  ObjectTimeStamp: TimeStamp; }
  ...
  _ObjectTimeStamp: TInstantTimeStamp;
private
  function GetObjectTimeStamp: TDateTime;
  ...
published
  // When the contact has been stored (created or changed) the last time
  property ObjectTimeStamp: TDateTime read GetObjectTimeStamp;
end;

procedure TContact.BeforeStore;
begin
  if Name = '' then
    raise Exception.Create('Contact name required');
  inherited;
  City := Address.City;
  _ObjectTimeStamp.Value := Now;
end;

With the FireDAC broker on MS SQL Server the attribute is stored in a DATETIME2(7) column.

Released under Mozilla License, Version 2.0.