I have been using TMS Data Modeler to import database and then export model to Aurelius ORM. Default association fetch mode is lazy. Something his changed now in the newest version 2.6. I can't access correctly foreign key associations any more.
Foreign key association is Assigned, but trying to access property will raise an exception like:
EMappingNotFound raised
Cannot find mapping [Id] on class TFDPhysMSSQLCommand
As an example also I have issue like:
ObjectManager.Refresh(HCLDepartment);
Accessing foreign key Lazy association properties will produce similar exceptions like above, but if I replace that with new Evict-metod my functionality is ok:
When you use lazy loading, Aurelius will try to hit the database when the associated object is accessed. If you have destroyed the manager since then, weird errors will appear.
The fact Aurelius is claiming there is no mapping for TFDPhysMSSQLCommand, which is clearly not an entity class of you, indicates that you have some memory issues there.
Be sure to keep the manager alive if you want lazy associations to be loaded.
Hmmm...In that part of code I have only one permanent object manager. In think behavior is changed between versions 2.5 -> 2.6. I did not have this lazy association issue in previous version. Exception is always something strange about [Id] and class name reminds about database (like TFieldDefs, TFDParam or TFDOptionsContainer..). I didn't see these before. Could it be involved with FireDac?
Probably not FireDac related, it still seems a memory issue. Are you able to create a small project reproducing the issue (preferably using native SQLite)? We can then debug and fix it.
I downgraded to 2.5 and my application is working again ok.
As you proposed I made dirty sample project to demo the issue:
- It's based on AureliusGettingStarted.
- 2 tables and sample data taken from SQLserver to SQLite
- ORM to Aurelius is produced with TMS Data Modeler as in my real environment
Demo project have same functionality issue: 2.5 Aurelius is ok, but 2.6 Aurelius will produce error when refreshing objects having lazy FK-association.