Table of Contents

Reusing the code implemented in a parent module

What is rule overloading?

When using traditional module overloading; when a rule is redefined, it usually replaces the previous implementation (located in a parent module).

By using the property ParentModule and its methods, it is now possible to call the original implementation.

Example

Let's consider a UI view with an OnInitialized rule implemented in a module called ThirdParty.

You may want to create another OnInitialized rule in a module called MyBusiness and reuse the code already provided:

await ParentModule.OnInitialized(Arguments);

/* code specific to 'MyBusiness' goes here */
/* (...) */

Edge case #1

The property ParentModule is not available when editing a rule located in the same module as the UI view because rules cannot be defined in modules where the UI view doesn't exist.

Edge case #2

The property ParentModule is available in child modules even if none of the actual parent modules have an existing implementation of the rule: in that case an empty stub will be generated.

Additionally, if a parent module is upgraded with a new rule, that new code will automatically be integrated if the child rules used the ParentModule callbacks.