The MorphX Development Environment and Tools

  • 8/11/2014

Reverse Engineering tool

You can generate Visio models from existing metadata. Considering the amount of metadata available in AX 2012 (more than 50,000 elements and more than 18 million lines of text when exported), it’s practically impossible to get a clear view of how the elements relate to each other just by using the AOT. The Reverse Engineering tool is a great aid when you need to visualize metadata.

The Reverse Engineering tool can generate a Unified Modeling Language (UML) data model, a UML object model, or an entity relationship data model, including all elements from a private or shared project. To open the tool, in the Projects window, right-click a project or a perspective, and point to Add-Ins > Reverse Engineer. You can also open the tool by selecting Reverse Engineer from the Tools menu. In the dialog box shown in Figure 2-18, you must specify a file name and model type.

FIGURE 2-18

FIGURE 2-18 The Reverse Engineering dialog box.

When you click OK, the tool uses the metadata for all elements in the project to generate a Visio document that opens automatically. You can drag elements from the Visio Model Explorer onto the drawing surface, which is initially blank. Any relationship between two elements is automatically shown.

UML data model

When generating a UML data model, the Reverse Engineering tool looks for tables in the project. The UML data model contains a class for each table and view in the project and the class’s attributes and associations.

The UML data model also contains referenced tables and all extended data types, base enumerations, and X++ data types. You can include these items in your diagrams without having to run the Reverse Engineering tool again.

Fields in AX 2012 are generated as UML attributes. All attributes are marked as public to reflect the nature of fields in AX 2012. Each attribute also shows the type. The primary key field is underlined. If a field is a part of one or more indexes, the field name is prefixed with the names of the indexes; if the index is unique, the index name is noted in braces.

Relationships in AX 2012 are generated as UML associations. The Aggregation property of the association is set based on two conditions in metadata:

  • If the relationship is validating (the Validate property is set to Yes), the Aggregation property is set to Shared. This is also known as a UML aggregation, represented by a white diamond.
  • If a cascading delete action exists between the two tables, a composite association is added to the model. A cascading delete action ties the lifespan of two or more tables and is represented by a black diamond.

Figure 2-19 shows a class diagram with the CustTable (customers), InventTable (inventory items), SalesTable (sales order header), and SalesLine (sales order line) tables. To simplify the diagram, some attributes have been removed.

FIGURE 2-19

FIGURE 2-19 UML data model diagram.

The name of an association endpoint is the name of the relationship. The names and types of all fields in the relationship appear in braces.

UML object model

When generating an object model, the Reverse Engineering tool looks for Microsoft Dynamics AX classes, tables, and interfaces in the project. The UML model contains a class for each Microsoft Dynamics AX table and class in the project and an interface for each Microsoft Dynamics AX interface in the project. The UML model also contains attributes and operations, including return types, parameters, and the types of the parameters. Figure 2-20 shows an object model of the most important RunBase and Batch classes and interfaces in Microsoft Dynamics AX. To simplify the view, some attributes and operations have been removed and operation parameters are suppressed.

FIGURE 2-20

FIGURE 2-20 UML object model diagram.

The UML object model also contains referenced classes, tables, and all extended data types, base enumerations, and X++ data types. You can include these elements in your diagrams without having to run the Reverse Engineering tool again.

Fields and member variables in AX 2012 are generated as UML attributes. All fields are generated as public attributes, whereas member variables are generated as protected attributes. Each attribute also shows the type. Methods are generated as UML operations, including return type, parameters, and the types of the parameters.

The Reverse Engineering tool also picks up any generalizations (classes extending other classes), realizations (classes implementing interfaces), and associations (classes using each other). The associations are limited to references in member variables.

For more information about the elements in a UML diagram, see “UML Class Diagrams: Reference” at http://msdn.microsoft.com/en-us/library/dd409437.aspx.

Entity relationship data model

When generating an entity relationship data model, the Reverse Engineering tool looks for tables and views in the project. The entity relationship model contains an entity type for each AOT table in the project and attributes for the fields in each table. Figure 2-21 shows an entity relationship diagram (ERD) for the tables HcmBenefit (Benefit), HcmBenefitOption (Benefit option), HcmBenefitType (Benefit type), and HcmBenefitPlan (Benefit plan).

FIGURE 2-21

FIGURE 2-21 ERD using Crow’s Foot notation.

Fields in AX 2012 are generated as entity relationship columns. Columns can be foreign key (FK), alternate key (AK), inversion entry (IE), and optional (O). A foreign key column is used to identify a record in another table, an alternate key uniquely identifies a record in the current table, an inversion entry identifies zero or more records in the current table (these are typical of the fields in nonunique indexes), and optional columns don’t require a value.

Relationships in AX 2012 are generated as entity relationships. The EntityRelationshipRole property of the relationship is used as the foreign key role name of the relation in the entity relationship data model.

Related resources

There are currently no related titles.