Tuesday 28 August 2018

Delegates concept in D365

Delegates allow us to access elements in higher models form a lower model. With a model split a hierarchy has been created where a higher model can take dependencies and access elements in the models below, but not in models above.

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

Key Updates in Dynamics 365 F&O for Version 10.0.39

Here’s a concise summary of the  platform updates  in  Microsoft Dynamics 365 Finance & Operations version 10.0.39 (March 2024) : 1- Add...