While the model split provides many benefits, it creates a problem when trying to access elements defined in higher models. Delegates are the recommended method for accessing elements in higher models from a lower model. Delegates are very similar to events in that when a delegate instance is invoked, a handler with compatible signature code is executed. This permits higher layer code, the handler, to be called by lower layer code, the delegate instance.
Delegate methods serve as a means for defining a contract between the delegate instance and the delegate handler. A delegate takes no action itself. This is enforced by having a void type and having no code in the method.
A delegate declaration must have three things:
- The delegate keyword
- Type void
- Empty method
For demo purpose, please refer Using Delegates in AX7 / D365 blog post that can describe how we can use delegates using X++.
No comments:
Post a Comment