Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js
Development options with Dynamics AX
If you are interested in developing applications for Dynamics AX, there are two broad categories of technology choices you can make to base your development on. Firstly, you can use Dynamics AX's own internal programming language called X++. This language allows you to program custom logic within the Dynamics AX system itself. However, because .NET development is the norm nowadays, Dynamics AX also allows you to write .NET framework code to build your own applications. Let's look at both of these options in turn.
The original technology used to develop custom solutions for Dynamics AX is the X++ programming language. This language has a familiar-looking syntax at least to all developers knowing a C-based language, such as C++, C# programming or Java. When you install Dynamics AX, you will also gain access to an integrated development environment with which you can write code.
The X++ language itself has syntax similar to the C language, but also contains object-oriented features. Development is usually done directly inside Dynamics AX, where the development environment hosts a compiler and a debugger. The compiler is also smart enough to give the developer optimization tips: for example poorly written SQL statements cause the compiler to display performance tuning tips.
X++ exposes a wide range of functions which can be used to integrate custom code with the system. You can access data inside the Dynamics AX database, create new user interface elements such as menus and forms, and more. Here's a quick glimpse of the X++ language showing the classic "Hello, World!" message:
static void main(Args args)
info("Hello, World from X++ language!");
To test this code in Dynamics AX, you would need to add a new class, and additionally a new method called main into the class. Then, to display a message on the screen, you could for example use the global info function (Figure 3).
[Figure 3 - Info Message.png]
The alternative to X++ language development in Dynamics AX is to use .NET framework technologies. If you prefer to use .NET and languages such as C#, you can develop in two different ways: you can write libraries (DLLs) that Dynamics AX loads and runs, or you can use the Dynamics AX object model directly from your own .NET applications.
Developing a DLL to be used inside Dynamics AX
The first option to integrate .NET code and Dynamics AX is to use a feature called .NET CLR Interop (Common Language Runtime Interoperability). This feature allows you to develop a .NET DLL with C# and then use X++ code to call methods inside the DLL.
One of the features in .NET CLR Interop allows you to call basic classes inside the .NET framework directly from X++. For instance, to get the current date by using the .NET class
System.DateTime, you could use the following X++ code:
static void main(Args args)
now = System.DateTime::get_Now();
datestr = now.ToString();
info("It is now: "+datestr);
Although a very simple example, the above code snippet shows that .NET is already deeply integrated into Dynamics AX 2009. However, to be able to use your own .NET code inside a custom DLL (assembly in .NET speak), you will first need to tell Dynamics AX where to find your assembly.
To be able to reference custom DLLs within Dynamics AX, you will need to learn about the Application Object Tree, or AOT. The Application Object Tree is the central location through which all objects, code, and user interface elements are kept. You can view the Application Object Tree in Dynamics AX by clicking the Application Object Tree button on the toolbar (Figure 4). This command opens the full tree, and since you are at this point interested in referencing custom DLLs, then scroll down the object tree to find the References node. On the keyboard, you can press Ctrl+D to get quick access to the object tree.
[Figure 4 - Show AOT Toolbar.png]
The References section lists all the .NET assemblies that the Dynamics AX system is aware of. To add your custom DLL to the list, you should first copy it to the
Client\Bin folder under the Dynamics AX installation path. The path is usually
C:\Program Files\Microsoft Dynamics AX\50\Client\Bin.
Once you have copied your custom DLL to this folder, the next step is to right-click the References node in the Application Object Tree, and choose the Add Reference command from the popup menu. In fact, this is just like you would do inside Microsoft Visual Studio (Figure 5).
[Figure 5 - Add Reference.png]
Once the reference is in place, you can start writing some X++ code. In the Application Object Tree, create for instance a new job under the Jobs node, and write for instance the following method to retrieve a string from the .NET DLL:
static void DotNetIntegration(Args _args)
myClass = new HelloDynamicsAxLibrary.HelloDynamicsAx();
message = myClass.SayHello();
In this example, the X++ code first instantiates a .NET public class called
HelloDynamicsAx, and then calls its public
SayHello method (Figure 6). Of course, this is a simple example of returning just strings from .NET code to Dynamics AX, but you could very easily write more advanced functions with
C# programming. At the end of the X++ listing, the info function shows a message on the screen. Remember that Dynamics AX was developed before .NET Framework 4.0 and Microsoft Visual Studio 2010 became available. Thus, the .NET runtime version hosted inside Dynamics AX is of version 2.0. However, you don't need to resort to developing your code with Microsoft Visual Studio 2005, because both Microsoft Visual Studio 2008 and 2010 support changing the target .NET framework version when you first create a project (or at later time from project properties). See Figure 7.
[Figure 6 - Call C# DLL.png]
[Figure 7 - Target .NET Version.png]