Dynamics
AX allows you to generate Visio models from existing metadata.
Considering the amount of metadata available in Dynamics AX 2009 (more
than 30,000 elements and more than 7 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 Visio Reverse
Engineering tool is a great aid when you need to visualize metadata.
Note
You must have Office Visio 2003 or later installed to use the Visio Reverse Engineering tool. |
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, right-click
a project or a perspective, point to Add-Ins, and then click Reverse
Engineer. You can also open the tool by selecting Reverse Engineer from
the Development Tools menu. In the dialog box shown in Figure 1, you must specify a file name and model type.
When you click OK, the tool
uses the metadata for all elements in the project to generate a Visio
document that opens automatically in Visio. 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 model contains a class for each table and
view in the project and its attributes and associations. Figure 2 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.
The
UML 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 Dynamics AX
are generated as UML attributes. All attributes are marked as public
because of the nature of fields in Dynamics AX. Each attribute also
shows the type. The primary key field is underlined. If a field is a
part of one or more indexes, the names of the indexes are prefixed to
the field name; if the index is unique, the index name is noted in
brackets.
Relationships in Dynamics
AX 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 UML
aggregation, visualized 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
life span of two or more tables and is visualized by a black diamond.
The end name on
associations is the name of the Dynamics AX relationship, and the names
and types of all fields in the relationship appear in brackets.
UML Object Model
When generating an
object model, the Reverse Engineering tool looks for Dynamics AX
classes, tables, and interfaces in the project. The UML model contains a
class for each Dynamics AX table and class in the project and an
interface for each Dynamics AX interface. The UML model also contains
attributes and operations, including return types, parameters, and the
types of the parameters. Figure 3 shows an object model of the most important RunBase and Batch
classes and interfaces in Dynamics AX. To simplify the view, some
attributes and operations have been removed, and operation parameters
are suppressed.
The UML model
also contains referenced tables, classes and 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 Dynamics AX 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.
Note
To
get the names of operation parameters, you must reverse engineer in
debug mode. The names are read from metadata only and placed into the
stack when in debug mode. You can enable debug mode on the Development
tab in the Options dialog box by selecting When Breakpoint in the Debug
Mode list. |
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 each table’s fields. Figure 4 shows an Entity Relationship Diagram (ERD) with the CustTableInventTable (Inventory Items), SalesTable (Sales Order Header), and SalesLine (Sales Order Line) tables. To simplify the diagram, some attributes have been removed. (Customers),
Fields in
Dynamics AX 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 Dynamics AX are generated as entity relationships. The EntityRelationshipRole
property of the relationship in Dynamics AX is used as the foreign key
role name of the relation in the entity relationship data model.
Note
The
Reverse Engineering tool produces an ERX file. To work with the
generated file in Visio, you must start Visio, create a new Database
Model Diagram and select Database, and point to Import and then Import
Erwin ERX file. Afterward you can drag relevant tables from the Tables
And Views pane (available from the Database menu) to the diagram canvas. |