nerdexam
Microsoft

MB-500 · Question #326

A company is implementing Dynamics 365 Finance. You must add custom logic before and after the following methods to extend the functionality by using Chain of Command. You need to implement the…

The correct answer is A. protected static void method3(...) {...} E. public static void method1(...) {...}. Class extension - Method wrapping and Chain of Command The following sections give more details about the capabilities of method wrapping and CoC. Wrapping public and protected methods Protected or public methods of classes, tables, data entities, or forms can be wrapped by…

Develop business logic

Question

A company is implementing Dynamics 365 Finance. You must add custom logic before and after the following methods to extend the functionality by using Chain of Command. You need to implement the development components that will allow the desired functionality. Which two methods can you extend? Each correct answer presents a complete solution. NOTE: Each correct selection is worth one point.

Exhibit

MB-500 question #326 exhibit

Options

  • Aprotected static void method3(...) {...}
  • BHookable(false)]
  • C[Wrappable(false)]
  • Dprivate static void method2(...) {...}
  • Epublic static void method1(...) {...}

How the community answered

(26 responses)
  • A
    81% (21)
  • B
    4% (1)
  • C
    12% (3)
  • D
    4% (1)

Explanation

Class extension - Method wrapping and Chain of Command The following sections give more details about the capabilities of method wrapping and CoC. Wrapping public and protected methods Protected or public methods of classes, tables, data entities, or forms can be wrapped by using an extension class. The wrapper method must have the same signature as the base method. When you augment form classes, only root-level methods can be wrapped. You can't wrap methods that are defined in nested classes. Currently, only methods that are defined in regular classes can be wrapped. Methods that are defined in extension classes can't be wrapped by augmenting the extension classes. This capability is planned for a future update. Not B: If a method is explicitly marked as [Hookable(false)], the method can't be wrapped in an extension class. In the following example, anyMethod can't be wrapped in a class that augments [Hookable(false)] public void anyMethod() {...} Not C: It must be wrappable. Note: Final methods and the Wrappable attribute Public and protected methods that are marked as final can't be wrapped in extension classes. You can override this restriction by using the Wrappable attribute and setting the attribute parameter to true ([Wrappable(true)]). Similarly, to override the default capability for (non-final) public or protected methods, you can mark those methods as non-wrappable ([Wrappable(false)]). Not D: Only public, not private. Note: 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. https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/extensibility/method-

Topics

#Chain of Command#method extensibility#Wrappable#Hookable

Community Discussion

No community discussion yet for this question.

Full MB-500 Practice