Class change trigger
Hello community,
Is there a way in Caché to trigger some method when any class changes? For example, if I edit any class in any namespace, when I save this class I want some method to be triggered with the class name parameter or any available data about the class.
Concretely, I tried to add a %OnAfterSave()
callback to the %Dictionary.ClassDefinition
class, but this method is not triggerred when any class saved as I expected. I am writing a project in Caché and the purpose of my project is to show editing history of the edited classes in the Caché studio.
Thank you in advance for your response.
Here are some thoughts:
I would have done it like this:
Modification of system classes is not a very good idea:
That being said, the best solution in my opinion is to setup your critical/production systems in such a way, that developers do not have direct write access to them. Each of the developers have their own environment where they can do whatever and then commit it to source control system. Continuous integration solution (or one developer or a script) then uploads the code (after it passes the tests) to the production server. There are several source control/continuous integration systems available for Caché.
It is a good idea that a change can only be done via source control commit. All other changes simply should not exist.
While not specifically an answer to your question I have used Class Projections as a way to detect when a class is compiled or removed. This will not allow you to see the changes between classes but could be useful to see when classes are compiled.