Business Central 2023 wave 1 (BC22): Type Hierarchy and Go-To Implementation

Dynamics 365 Business Central

Hi, Readers.
Dynamics 365 Business Central 2023 wave 1 (BC22) is generally available this month. More details: Dynamics 365 Business Central 2023 release wave 1 (BC22)

I will continue to test and share some new features that I hope will be helpful.

These two new feature are mentioned in Business Central Launch Event (2023 release wave 1) and AL Language extension changelog version 11.0.

Type Hierarchy: If you want to figure out where are the extension objects to a given object, you can now use the “Type Hierarchy” functionality in VSCode to do so.

Go-To Implementation: To find which codeunits or enums implement an Interface, it is now possible to use the “Go To Implementations” command.
If the command is invoked on a procedure, it will find the implementations of that procedure on other codeunits as well.

Let’s look at the Go-To Implementation first. This is also mentioned in the 2023 wave1 release plan.

Go to implementation for interfaces:

Business value
Interface is a core concept for writing extensible code, that abides by a predefined contract. Until now, it’s been hard for developers to quickly find implementations of a given interface or procedure on the interface in their own workspace, as the go to implementation has not been supported. In this release we’re adding that support, making developers more productive, and removing the need to look through all references to find it.

https://learn.microsoft.com/en-us/dynamics365/release-plan/2023wave1/smb/dynamics365-business-central/go-implementation-interfaces

An interface in AL is similar to an interface in any other programming language; it’s a syntactical contract that can be implemented by a non-abstract method. More details: Interfaces in AL

Let’s look at a specific example. I created an Interface example, which contains the following objects. More details: Interface example

You can now use the standard Visual Studio Code context menu option “Go to Implementations” or press Ctrl+F12 on an interface to view all the implementations within scope for that interface. This works on interfaces, and on codeunits and enums implementing an interface, as well as their procedures if it maps to one on an interface.

You can find which codeunits or enums implement an Interface. Very convenient.

Double-click to jump directly to the object.

Then let’s look at the Type Hierarchy.
Type Hierarchy is now supported, although AL language does not really have inheritance. (Supports Extends and Implements)

You can use context menu option “Show Type Hierarchy“.

Or, use context menu option “Peek -> Peek Type Hierarchy” to display Type Hierarchy.

PS: It is also available for interfaces.

Give it a try!!!😁

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL