I have some questions/confirmations about combination of ObjectManager and TAureliusDataset.
Let's say I have a manager that is created on form creation. And I have a AureliusDataset that fills data using SetSourceCriteria.
The questions are:
What happened in the objectmanager when I call SetSourceCriteria several times?
Is it better to destroy and recreate manager when I recall SetSourceCriteria?
No need to recreate the manager. SetSourceCriteria only provides the dataset with query information it will use to retrieve objects from the database. Retrieved objects will stay alive in the manager, and if further queries are performed, cached objects might be reused. Objects will be destroyed when manager is destroyed, or Clear method is called.
Tell me, why can't I create a global Manager and use it everywhere in the application? It turns out that the received objects are cached and then everything will be faster. Am I wrong?
You can, but it's not good practice. You said yourself, objects will stay in the cache, your memory usage will grow overtime, and at some point no more objects are retrieved from the database, since they are cached, the manager reuses them. You would have to explicitly ask for object refresh.
I have used global manager for a
unigui app but I achieve only problems and strange behaviors. Now I use
a manager per form or frame and works ok.