Reverse Engineering Microsoft Dynamics AX

April 11, 2008

The Reverse Engineering tool is a feature newly added to the integrated development environment (IDE) of Microsoft Dynamics AX. This tool replaces Visual MorphXplorer which has been removed in version 4.0.

Dynamics AX Reverse Engineering

As the name suggest, this tool helps us retrieve detail information on the structures and relationships of Microsoft Dynamics AX objects. The retrieved information is transformed to a visually readable format in Microsoft Office Visio UML model. Technically, Dynamics AX will create a Microsoft Office Visio Drawing file (.vsd) using the Visio application component and construct a UML model with Visio UML add-on programmatically. Therefore you will need Microsoft Office Visio 2003 or greater with Visio UML model installed in order to use this tool.

Scoping Your Model

Naturally scoping required to create useful models. This allows us the flexibility to define what we want to include. In my opinion, a model of the complete Dynamics AX application would be too huge to be useful if not too time consuming to generate and maintain.

Dynamics AX Reverse Engineering tool scopes the model through development projects either private or shared. So you must first create a project and include the elements that you would like in your model in the project in order to generate a model.

Types of Model

This tool is capable of generating two types of model; data model and object model. Let's see what does these models capture and how do they differ.

Data model mainly captures tables. Tables within the project as well as tables referenced by them are included in the model. Tables within the project are grouped by the AX TableGroup property. They are organized under groups named Main, Group, Miscellaneous, Parameter, Transaction, WorksheetHEader and WorksheetLine. Referred tables will be placed under the group External Classes.

You will also find relevant information such as fields and its data type, indexes, and relationship of each table in the generated model. The data type of these fields is modeled in Dynamics AX Extended Data Type. Dynamics AX Extended Data Type used by the model is included under the group External Data Type. This is the same for Dynamics AX Base Enums. The referenced enumeration with their members is captured under group Base Enums.

Due to the use of Visio UML model, each of these tables will be represented by a class and fields are modeled as attributes. However, table method is not included here. Table method is an important feature of Dynamics AX development platform but methods are not quite relevant for data model.

Those that would like to have the methods included could use the object model instead. However, that model will not have data model information such as relationship and index.

Object model will capture classes, tables, and interfaces relevant to the project. This includes referenced objects as well. Tables and classes within the project are generated under the main group without further grouping. Referenced objects are placed under group External Classes just like Data Model.

The properties and methods of the classes are modeled as attributes and methods in the class diagrams. Table entities are modeled the same way too. Information synonymous to object model such as class extends another class, class implementation of an interface and call between classes are found in this model.

Data type that the properties and methods uses in the form of Dynamics AX Extended Data Type are included in the model under Extended Data Type group. The same happens to Base Enums.

The table generated in Object Model will have table methods modeled as method unlike those in Data Model. Since this is an object model, you will not find information such as field index and table relationship in this model.

InformationData modelObject model
TablesYesYes
Related tablesYesYes
Table fieldsYesYes
Table methodsNoYes
Table group propertyYesNo
Field indexYesNo
ClassesNoYes
Referenced classesNoYes
Extended Data TypesYesYes
Base EnumsYesYes
X++ Data TypesYesYes

How to Generate

This feature is only accessible through the context menu. The following are the steps to generate a UML model using this tool.

Dynamics AX Reverse Engineering Menu
  1. Create a project and move the elements you would like in the model into this project.
  2. Right click on the project and select Add-Ins>Reverse Engineer.
  3. This will load a form named Visio Reverse Engineering. Enter the path and filename for the Visio drawing file.
  4. Select the model you want to generate then press OK. You may generate either data model or object model.

Conclusion

This is good news for those that are already using Microsoft Office Visio for their modeling tasks and is familiar with Visio UML model. I have tried my hands on Visio UML model years ago but have never developed a liking for it.

Those that have already got used to generating data model with Visio Data Model Diagram might find the data model reverse engineering redundant. I agree that Visio Data Model produces excellent model but it reverse engineer at the database level. The challenge with AX is that a lot of information is not implemented at the database. AX relies heavily on extended data type and enumeration implemented at the application level. Another challenge is AX implementation of temporary table which does not appear in the database.

These challenges are addressed with the use of AX Reverse Engineering tool. Field data type will be represented in extended data types. Information regarding extended data types and base enums are included in the model too. Temporary tables could be included in the model. This is something that even the MorphXplorer does not support.

Is this better than MorphXplorer, the tool it replaced? I see much more information compared to MorphXplorer. The outcome is more professional too.