How it works...

The Argument Table pattern allows you to pass multiple parameters through your functions without having to define each parameter in the signature of the functions. This allows you to easily modify the set of parameters in the future, without having to refactor your function calls.

This pattern is implemented by creating a table to hold the parameter values. You can define any type of field as required by the parameter. You do not need to define any keys since no physical entries will be created in the table.

Using a combination of this pattern and events, you can build a solution that will allow the parameters of your routine to be extended (via a table extension on the Argument Table pattern) and the logic of those new parameters to be implemented (by using an event at the place you use the parameters). 

In our recipe example, in order for a developer to add a new parameter that's used in the Copy Transaction routine, all they'd have to do is the following:

  1. Extend the Copy Transaction Argument table to add a new field for the new parameter.
  2. Subscribe to the OnBeforeInsertNewTransactionEntry() event and write logic that to handle the new parameter.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset