Empty string fields

Hi!


I have updated to the latest Aurelius and I have a problem. The string properties of the retireved objects are always empty.

I'm using FireDAC and if I drop a query + dbgrid, I can see all the values, so I think the DB layer is OK.

The procedure to retreve the data is this:


connAdmin.Connected := true;
FDTable1.Open(); // This is to check the data in the DB grid - debugging.. :)
AdminConnection := TFireDacConnectionAdapter.Create(connAdmin, false);

Manager := TObjectManager.Create(AdminConnection);
try
  Result := Manager.Find<TCustomer>.List;
finally
  Manager.Free;
end;



for itm in list do begin
      ShowMessage(itm.AppName);  // <-- Always empty! 
end;


Also other string properties are empty, but dates, booleans, integers.. etc. are filled correctly.

Is this a bug or am I doing something wrong?



You are destroying the manager, thus all objects retrieved as also destroyed. Strings are empty because they are managed types. Dates, booleans and integers are visible because they are still accessing memory garbage (the previous values). 

Thank you, it works.


But I'm a little confused, because according to the manual

http://www.tmssoftware.biz/business/aurelius/doc/web/object_manager.html

Creating a new object manager

 

Directly create a TObjectManager instance, passing the IDBConnection interface that represents a database connection:

 

Manager := TObjectManager.Create(MyConnection);
try
  // perform operations with objects
finally
  Manager.Free; 
end;

 

I should free the manager after using it. Did I understood the manual too strictly?

Yes, but you can see "perform operations with objects".

While you are using the objects, the manager must stay alive. Once you are done, destroy the manager.
Here is more information about lifetime of managed objects: 
https://download.tmssoftware.com/business/aurelius/doc/web/memory_management.html

Ok, I got it where I made the mistake - thank you!