Hi I have document class with property Status (e.g doc.Status) and the situation is as follows: when the Status property is set to confirmed I want to create another relative document. When the doc status is set to other than confirmed I want to delete that relative document(if such exists). What’s the best way to achieve this? To set if clause in the property set method or to fire event with the same if clause when the property’s value have changed ?
Hi I have document class with property Status (e.g doc.Status) and the situation is
Share
It depends on the behavior you want to achieve for your functionality.
1) Using “If Clause” in set property:
In this method, once you will compile your document class, you cannot change the behavior as the set property becomes hard-coded then. So, if the only thing that is to be done is to create and delete relative document, then this method is preferable.
2) Creating events for change in “status” property:
This functionality should be used in case when you want to decouple the action performed after any change in “status” property from your document class. If the business-logic to be executed after the “status” property is changed, is not decided at the time of compilation of document class, then this method is preferable.
The choice is yours!!