Aspect Programming


I'm looking for a way to hook into the Object Manager. I want to do implement logging and security through Aspect programming (A sort of OnBeforeExecute and OnAfterExecute on a virtual method, but in memory through the virtual method table). The DSharp library provides me the base classes to do this. Aspect programming is implemented there through TVirtualMethodInterceptor, however it requires the methods being virtual.

Could the public methods on TObjectManager be declared virtual, so they can be intercepted? The only alternative I see otherwise is to create a descendant and use that one, but that seems overkill.

The same question would apply to the TDatabaseManager class for the same reason

Yes, we could make them virtual, which methods do you suggest to be virtual? Note that generic methods can't be made virtual in Delphi.

Also, we plan to add more events (or callback system through interfaces) so Aurelius will have such mechanism built-in.