onAfterLoaded event?

Ok, still learning Aurelius I have encountered with an issue. May be I am doing something wrong but I couldn´t find anything in the documentation. Let suppose we have the following classes:



[Entity]
... // All Aurelius stuff
TCensus = class
private
	[Column('males', [])]
        fMales : Integer;
	[Column('females', [])]
        fFemales : Integer;
        fCensusCalculator : TCensusCalculator;
       function getCensus : Integer;
public
       property Males : Integer read fMales write fMales;
       property Females : Integer read fFemales write fFemales;
       property Census : Integer read getCensus;
       procedure AfterConstruction; override;
end;


procedure TCensus.AfterConstruction;
begin
	inherited;
       // Lets suppose the following internal class does some complex calculations based on field values.
        fCensusCalculator := TCensusCalculator.Create;
  
        fCensusCalculator.Males := fMales; // <--- I need the loaded value from the database, but at this point is not loaded yet!
        fCensusCalculator.Females := fFemales; // Here again
end;


function TCensus.getCensus;
begin
	Result:=fCensusCalculator.Result;	
end;


How can I have an event handler or procedure to execute just after Aurelius has finished loaded an object from the database?

Thanks


No one? At least I need to know if it´s not supported. 

Hello Luis,

 
currently there is no such event indeed. Actually I'm not sure if this would be a reliable approach since even if we include this event, keep in mind that Aurelius manages objects lifetime. It means that sometimes objects are cloned, destroyed, recreated, and this could led to a confusion for the programmer relying on such events. Alternatively you could just use the setter of the property. For example, in the setter of Males property, you set the FSensusCalculator.Males property as well.