Managing DLL

Before Microsoft introduced dot net, we had automation control of the DLL files. These DLL files needed to be registered on each machine. This is what people refer to as DLL Hell.

In the case of Microsoft Dynamics NAV, we refer to DLL Hell in a different way.

The challenge of using DLL in Dynamics NAV, whether it is an automation control DLL or a custom made .NET DLL, is that the compiler checks the references. This screenshot shows the error message in the case of a missing DLL reference:

Managing DLL

Since it cannot be expected that every developer has every customer's DLLs installed, it is considered best practice to wrap DLL in a one-to-one Codeunit. Each function in DLL gets a function in the wrapper Codeunit.

Instead of calling DLL directly as a variable, we will use the wrapper Codeunit. This enables developers to change the code without having the DLL installed.

This can potentially also be interpreted as an adaptor or a Façade.

The following screenshot illustrates creating a wrapper Codeunit and calling that from a new Codeunit. The new Codeunit can always be compiled, even if the DLL does not exist:

Managing DLL
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.9.48