Technical description
The Singleton pattern contains a table object with a specific primary key structure that is enforced by the system, allowing the table object to contain only one record. Users cannot add or remove records. When a new company is created, a record in each Singleton table is created automatically, although this is optional.
To enforce the existence of a record when it is required, each Page object that is based on the table should contain business logic to create the record, in case it does not exist yet. The reasons for the record to be missing can be that the table was a part of an update, acquired after the company was created.
The following diagram explains how to implement the Singleton Pattern:
Since the Page objects, by default, allow users to create and delete records in tables, this should be blocked by setting the InsertAllowed and DeleteAllowed properties to No
on the page.
The table object always has a field named Primary Key
as a single Primary Key. This field has ID 1
, and Code 10
. The value of the key field is blank.