How can I use Aurelius and keep more than one database in the same project?
I have the following situation:
- system config files would be always sqllite database.
- after loaded system config the user logs in and according personal configuration it could be required to use another database type (not using the sqlite of the config)
- and in some cases it could be configured for each company of this user (multi tenancy) requires individual database files.
For example, in a store chain, each store is one separated database file. That can be different databases vendors. And it is required to know the total of invoices of the current month, then I need to go each store and retrieve the list of invoices. I can go one each time.
However I need to maintain then config database opened, since it holds many system information and specially the information where each table is located.
I am looking to use the ORM way, not thinking in tables, however sometimes I can handle many companies in the same database (company_id part of the primary key) and sometimes a need to have separated databases for each company.
You can just use a different IDBConnection for each database server you want to access. When you create a TObjectManager, you pass the IDBConnection to indicate the server you are connecting to. Also, you can provide the TMappingExplorer object with specific mappings to use in the object manager. Have you seen the chapter about creating different mapping setups? (http://www.tmssoftware.com/business/aurelius/doc/web/index.html?mapping_setup.htm)