Manager delete/frees global variable

Hi,

I fill data a TAureliusDataset using SetSourceCriteria. On after insert event I set the following  value/object

adsMaster.EntityFieldByName('PERIODID').AsObject:=GlobalVarsModule.userperiod;

Works ok but when I close the form that frees the Manager userperiod is already freed up.

Userperiod is a TPeriod object that I set it on the application start up and must be there till the log out of the user.

Is there any way the manager do not free up the userperiod?

Regards


Hi Nikolaos,

the best approach is to set a clone (copy) of the object in the manager. There is no selective destruction in manager, I mean, destroy these objects, but not these ones. This will be highly confusing. You can use Merge method to help you with the process:


adsMaster.EntityFieldByName('PERIODID').AsObject := adsMaset.Manager.Merge(GlobalVarsCmodule.userperiod);

Works great!

Thanks Wagner