Show/Hide Toolbars

TMS Aurelius Documentation

The TAureliusDBSchema component is a non-visual, design-time component that encapsulates the TDatabaseManager class, used to build, update and validate the schema structure of the database (tables, fields, foreign and primary keys, etc.).

 

TAureliusDBSchema and TDatabaseManager have equivalent functionality; the main purpose for TAureliusDBSchema component is to provide an alternative RAD approach: instead of instantiating a TDatabaseManager from code, you just drop a TAureliusDBSchema component, connects it to a TAureliusConnection component, and you are ready to go.

 

Key properties

 

Name

Description

property Connection: TAureliusConnection

Specifies the TAureliusConnection component to be used as the database connection.

 

TAureliusConnection acts as a connection pool of one single connection: it will create a single instance of IDBConnection and any manager using it will use the same IDBConnection interface for the life of the TAureliusConnection component.

 

The IDBConnection interface will be passed to the TDatabaseManager constructor to create the instance that will be encapsulated.

property ModelNames: string

The name(s) of the model(s) to be used by the manager. You can leave it blank, if you do it will use the default model. Two or more model names should be separated by comma. From the model names it will get the property TMappingExplorer component that will be passed to the TDatabaseManager constructor to create the instance that will be encapsulated.

property DBManager: TDatabaseManager

The encapsulated TDatabaseManager instance used to perform the database operations.

 

Usage

 

As mentioned, TAureliusDBSchema just encapsulates a TDatabaseManager instance. So for all functionality (methods, properties), just refer to TDatabaseManager documentation and related topics that explain how to build, update and validate the database schema.

 

The encapsulated object is available in property DBManager. If you miss any specific method or property in TAureliusDBSchema, you can simply fall back to DBManager instance and use it from there. For example, the following methods are equivalent:

 

AureliusDBSchema1.UpdateDatabase;
AureliusDBSchema1.DBManager.UpdateDatabase;

 

Actually effectively, the first method is just a wrapper for the second one. Here is how TAureliusDBSchema.UpdateDatabase method is implemented, for example:

 

procedure TAureliusDBSchema.UpdateDatabase;
begin
  DBManager.UpdateDatabase;
end;

 

Memory management

 

Here is the lifecycle of the encapsulated TDatabaseManager instance itself:

 

The TDatabaseManager instance will be created on demand, i.e., when TAureliusDBSchema is created, the TDatabaseManager is not yet created. It will only be instantiated when needed;

If the connection or model name is changed, the encapsulated TDatabaseManager instance will be destroyed. A new TDatabaseManager instance will be created with the new connection/model, when needed.