Hello..
The next part from a book , can anyone explain the yellow part
When writing data-event handlers, we must also take into account Chain of Command
extensions. The Using Chain of Command to initialize data recipe shows an alternative to using
data-events.
In this specific case, I would opt for Chain of Command, and the decision is based on many
factors, including the following:
1- Looking up data in order tables, where there is an InitFrom method for that
table that can be used instead.
2- Is the data likely to be inserted using a set-based operation with triggers
disabled, such as insert_recordset? These are common in journal and
transaction tables, and when data is inserted or updated through a data entity.
Data-events are ideal on main and worksheet tables, but care should be taken when using
this on journal or transaction tables. Code-based delegates should be safe, as are the
public methods that are designed to initialize data. Although we have discussed test
projects, writing tests for this purpose can seem pointless. However, it is a common source
for regression as Microsoft can change the way data is written to improve performance.
Pre- and post-event Handlers
Pre-and post event handlers are the last resort when we need to hook into standard code.
They are very prone to breaking changes, and can often compile and then fail at runtime.
They are mentioned here for completeness.
The only time you should encounter pre-post handlers is in code upgraded from AX 2012.
In these cases, we should change the code so that it either handles a delegate or uses a
Chain of Command.
Thanks experts.