Hello all,
following scenario:
SQLite data modelling with TMS Data Modeler and export to Aurelius.
As far as I can see defined triggers will not be handled in Aurelius creating the database file using
... DatabaseManager := TDatabaseManager.Create(FConnection); try DatabaseManager.BuildDatabase; // >>> create triggers here finally DatabaseManager.Free; end ...
What would be the best solution to implement these triggers manually? How can I access the phsyical table name within Aurelius?
I'm using both AnyDAC and native SQLite access.
... {$IFDEF ANYDAC} FConnection := TAnyDacConnectionAdapter.Create(ADAppConnection, False); {$ELSE} // Native SQLite FConnection := TSQLiteNativeConnectionAdapter.Create(s); {$ENDIF} ...
Thanks in advance for you suggestions.
Regards, Matthias
wlandgraf
(Wagner Landgraf)
June 26, 2012, 10:40am
2
Hello,
you would have to create triggers manually. Actually the idea of using TMS Data Modeler together with Aurelius is that the database is managed by Data Modeler, and you export classes to Aurelius to access the database using an ORM approach. But since you have many details in Data Modeler (triggers, check constraints, indexes, stored procedures, views, etc.), you should just generate the creation script from data modeler and run it from your application.
Ok, that would be a solution, thanks Wagner.
Additional question: How can I get the corresponding table name of an entity?
I'm not shure about the coding.
Example:
[Entity]
[Table('ptProject')] // how can I get the name?
[Id('FID', TIdGenerator.IdentityOrSequence)]
TptProject = class
private
[Column('ID', [TColumnProp.Required, TColumnProp.NoInsert, TColumnProp.NoUpdate])]
...
Can you show how to do this?
Regards,
Matthias
wlandgraf
(Wagner Landgraf)
June 26, 2012, 11:55am
4
You can use this piece of code:
TableName := ObjectManager.Explorer.GetTable(TptProject).Name;
But please note this is an unsupported feature and the code might break in a future release.