About this exam
This is the exam for Microsoft Certified: Dynamics 365: Finance and Operations Apps Developer Associate, aimed at developers who extend finance and operations apps such as Finance and Supply Chain Management. It covers developing AOT elements, business logic in X++, integration through data entities and services, reports and workspaces, testing and performance, and ALM.
Try a sample question
This is an original sample question written by itmoshi based on the exam objectives.
You need to add custom logic to process() in the Microsoft-supplied class SalesOrderProcessor. process() is a wrappable public instance method, and every standard caller, none of which you can change, instantiates SalesOrderProcessor directly. Your code must run both before and after the standard logic, must call calcSurcharge(), a protected method of the same class, and you must not change the source of Microsoft's model. Which approach should you use?
- AWrap process() in an extension class marked [ExtensionOf] and call next (Chain of Command)
- BRegister one pre-event handler and one post-event handler on process()
- COverlayer the class in Microsoft's model and edit process() directly
- DCreate a class derived from SalesOrderProcessor and override process()
Show answer and explanation
Answer:A Chain of Command lets you run code before and after the standard logic and use protected members.
Why it is correct
With Chain of Command you write process() with the same signature in a final extension class decorated with [ExtensionOf(classStr(SalesOrderProcessor))] and call next process() inside it. Code before next runs before the standard logic, and code after next runs after it. Wrapper methods can also access the protected methods and variables of the augmented class, so calcSurcharge() can be called. Microsoft's model is left untouched, which satisfies the no-source-change requirement.
The other options
- ✗ B Pre- and post-event handlers can add logic before and after, but a handler can use only the public members of the class, so it cannot call the protected calcSurcharge(). They suit cases where you only need to inspect or change the arguments or return value of a public method.
- ✗ C Microsoft's application models are sealed and cannot be changed by overlayering. Changes to the behavior of Microsoft code are made through extensions.
- ✗ D The standard callers instantiate SalesOrderProcessor directly, so an overridden process() in a derived class would never be called. Derivation is for a separate class that only your own code uses.
Key takeaway
Choosing an extension technique: logic before and after plus protected access → Chain of Command. Only inspecting public arguments or return values → pre/post event handlers. Plugging into a hook the class provides → subscribe to a delegate. Overlayering Microsoft's models is not allowed.
Try 26 questions like this for free
itmoshi is an unofficial study service and is not affiliated with Microsoft or any exam provider.