What’s new in X++ for AX 7

In this article we describe the main changes in the X++ language for AX 7. Almost all changes will appear because of the Visual Studio’s IDE.

No more p-code

  1. In AX 7 the new X++ compiler generates CIL only.
  2. Compiled X++ code now runs exclusively as .NET CIL.
  3. CIL runs much faster.

Enhancements to X++

  1. try … catch … finally:a564c-picture1
  2.  

  3. Initialize stuff in the class declaration statement.d3203-picture2
  4.  

  5. Declare variables in smaller scopes, not just at the start of methods.
  6. VAR keyword is available as a shortcut that allows the compiler to infer the type of the declared variable.
  7. An attribute declaration can omit suffix of attribute name if suffix is “Attribute”.

Backward-incompatible changes to X++

  1. No longer part of the X++ language (compile error) – changeSite, pause, window 
  2. The keywords client and server will be ignored, because all compiled X++ code is executed as .NET CIL on the server.
  3. CIL helper methods have been removed.
  4. AX 7 eliminates the concept of AOT > Jobs. Instead use static main method of a class and then set the class as the startup object from the AX 7 project.
  5. Use const type instead macros.

AX7 LINQ Provider for use in C#

Language Integrated Query (LINQ) is a set of classes and methods that enable you to access data that is stored in a variety of places and formats.

When very few records are fetched C# LINQ is three times longer than while select.

Original article in AX7DEV Blog.

Leave a comment