You have a Dynamics 365 Finance and Operations environment
HOTSPOT
You have a Dynamics 365 Finance and Operations environment.
You have the following code: (Line numbers are included for reference only.)
For each of the following statements, select Yes if the statement is true. Otherwise, select No. NOTE: Each correct selection is worth one point.
Answer:
Explanation:
Box 1: Yes
Class extension – Method wrapping and Chain of Command. The functionality for class extension, or class augmentation, has been improved. You can now wrap logic around methods that are defined in the base class that you’re augmenting. You can extend the logic of public and protected methods without having to use event handlers. When you wrap a method, you can also access public and protected methods, and variables of the base class. In this way, you can start transactions and easily manage state variables that are associated with your class.
Box 2: Yes
In the following example, the wrapper around doSomething and the required use of the next keyword create a Chain of Command (CoC) for the method. CoC is a design pattern where a request is handled by a series of receivers. The pattern supports loose coupling of the sender and the receivers [ExtensionOf(classStr(BusinessLogic1))]
final class BusinessLogic1_Extension
{
str doSomething(int arg)
{
// Part 1
var s = next doSomething(arg + 4);
// Part 2
return s;
}
}
Box 3: Yes
Instance and static methods can be wrapped by extension classes. If a static method is the target that will be wrapped, the method in the extension must be qualified by using the static keyword.
Box 4: No
Wrapper methods must always call next.
Note: Wrapper methods in an extension class must always call next, so that the next method in the chain and, finally, the original implementation are always called. This restriction helps guarantee that every method in the chain contributes to the result.
In the current implementation of this restriction, the call to next must be in the first-level statements in the method body.
Here are some important rules:
– Calls to next can’t be done conditionally inside an if statement.
– Calls to next can’t be done in while, do-while, or for loop statements.
– A next statement can’t be preceded by a return statement.
– Because logical expressions are optimized, calls to next can’t occur in logical expressions. At runtime, the execution of the complete expression isn’t guaranteed.
Reference: https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/extensibility/method-wrapping-coc
Latest MB-500 Dumps Valid Version with 117 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund