Show/Hide Toolbars

TMS Aurelius Documentation

Navigation: Manipulating Objects

TAureliusManager Component

Scroll Prev Top Next More

The TAureliusManager component is a non-visual, design-time component that encapsulates the TObjectManager class, used to persist and retrieve objects in database.


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


Key properties




property Connection: TAureliusConnection

Specifies the TAureliusConnection component to be used as the database connection. Any persistence operation performed by the manager will use the connection provided by the TAureliusConnection component.


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 TObjectManager constructor to create the instance that will be encapsulated.

property ModelName: string

The name of the model to be used by the manager. You can leave it blank, if you do it will use the default model. From the model name it will get the property TMappingExplorer component that will be passed to the TObjectManager constructor to create the instance that will be encapsulated.

property ObjManager: TObjectManager

The encapsulated TObjectManager instance used to perform the database operations.




As mentioned, TAureliusManager just encapsulates a TObjectManager instance. So for all functionality (methods, properties), just refer to TObjectManager documentation and related topics that explain how to save objects, update them, retrieve, querying, etc.


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




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


procedure TAureliusManager.Save(Entity: TObject);


Memory management


All entities are manage inside the TObjectManager instance, using the regular memory management mechanism of such class. The only thing you should be aware is the lifecycle of the TObjectManager instance itself:


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

If the connection or model name is changed, the encapsulated TObjectManager instance will be destroyed (and as a consequence all entities managed by it). A new TObjectManager instance will be created with the new connection/model, when needed.