Event AfterLoad for Proxy

For normal we are using Proxy-Fields for Associations and ManyValuedAssociations.

Because, there are a lot of possible situations, trigger Proxy.Load, I would need an Event AfterLoad, like ProxyController have, so that I could do some stuff after my proxy is loaded.

It would be fine for me, if I could just assign my Event in constructor of my Entity.

For example:

TEntity2 = class;

TEntity = class
  FProxy: Proxy<TEntity2>;
  FProxyList: Proxy<TList<TEntity2>>;
  procedure AfterLoadProxy(aSender: TObject); // should be triggering Proxy-Field
  constructor Create;

constructor TEntity.Create;
  FProxy.OnAfterLoad := AfterLoadProxy;
  FProxyList.OnAfterLoad := AfterLoadProxy;

Just out of curiosity, what kind of code you want to add in such event handler?

For example registering this fetched Entities to an owner, handling memory-management in cases TObjectManager does not, (but does while Proxy is loaded).

1 Like

another example is, that this would allow us to use TList-OnNotify Event for monitoring changes.
Right now it works until proxy is loaded...

1 Like