Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
CHAPTER 2: MORPHX
Objectives
The objectives are:
Introduction
Microsoft Dynamics AX 2012 is an innovative release that brings users
improved and new functionality. This version introduces many new features in
both the technical and application areas. The new features improve the way both
users and developers interact daily with the application, and how they customize
and setup the application to fit their individual needs.
2-1
Model Repository
In earlier releases of Microsoft Dynamics AX the setup program installs
deployment files, such as the Application Object Data (AOD) and Application
Label Data (ALD) files on a file share. In Microsoft Dynamics AX 2012, the
application file share is no longer required. The application files on the
application share are organized and moved to different containers as described in
the following list:
The content of the AOD files are now stored in the model store and
alternate model store.
Static files are either moved to the file system in the Application
Object Server (AOS) instances, or converted into standard
Application Object Tree (AOT) resources.
Partners can fully take advantage of SQL capabilities and the backend tool set.
Labels files are moved to the SQL database and integrated with
model data.
2-2
Chapter 2: MorphX
Models and Model Files
A model is a logical grouping of elements in a layer. An element can exist in
exactly one model in a layer. Examples of elements are a table or class. The same
element can exist in a customized version in a model in a higher layer. New
models are easy to create. Models can be exported, installed, or uninstalled from
the model store. Models are identified by a name and a publisher, and have a set
of properties that can be changed, including a version number.
Model files, with an .axmodel extension, are the new artifact to handle models. A
model file resembles an AOD file from earlier versions. However, the names or
numbers are not limited.
Management of Models
Microsoft Dynamics AX 2012 provides the following options to manage models.
2-3
2-4
Chapter 2: MorphX
3. Open the administrative utility axutil.exe.
4. Enter the command axutil.exe /? and then click Enter.
5. Review the various commands and parameters that are used by each
command.
2-5
2-6
Chapter 2: MorphX
The current model can be set at the Microsoft Dynamics AX command line
(AxUtil.exe), or by selecting the startup model in the User Option. To set the
startup model in User Options select Tools > Options > Development > Startup
model.
2-7
2-8
Chapter 2: MorphX
Moving Model Elements
Any element created in the current layer can easily be moved to another model in
the same layer. You can move an element by selecting the element in the AOT,
right-clicking the element and then selecting Move to model.
2-9
2-10
Chapter 2: MorphX
Procedure: Import a Model
To import the CONTOSO model in the user layer, follow these steps:
1. Re-create the class in the User Model with the same class name as in
the previous procedure.
2. Right-click the Classes node and select New Class.
3. Right-click the new class and select Rename.
4. Enter the same name for the class as used in the previous procedure.
5. Right-click the class and select New > Method to create a new
method.
6. Save the class.
7. Go to Start > All Programs > Accessories > Command Prompt.
8. Enter the following command to go to the appropriate directory: cd
"c:\Program Files\Microsoft Dynamics
AX\60\Server\MicrosoftDynamicsAX\Bin".
9. Enter the following command to add the "CONTOSO" model:
AxUtil.exe import /file:c:\ContosoModel.axmodel /layer:USR
/conflict:push.
10. Enter the following command to list all current models. Notice that
the "CONTOSO" model is now listed: AxUtil.exe list.
11. Make sure that the model is imported in the USR layer and a Conflict
model is created in the USP layer.
2-11
2-12
Chapter 2: MorphX
Need a Little Help?: Import a Model
1. Re-create the class in the User model.
2. Import the previously exported model by using the AxUtil.exe
command.
3. Make sure that the model is imported and a Conflict model is
created in the USP layer.
2-13
2-14
Chapter 2: MorphX
Development Workspace
In Microsoft Dynamics AX 2012, the development experience is separated from
the application experience as a new workspace. The developer workspace
contains all the tools and features a developer needs for creating and customizing
a Microsoft Dynamics AX application. Saved changes in the Development
Workspace are always synchronized with the Application Workspace within the
same client instance. There can be eight workspaces in total of either type for
each client instance. Application elements can still be opened in the AOT, or you
can open an Application Workspace from the Development Workspace to view
your customizations.
X++ Editor
In Microsoft Dynamics AX 2012, a new X++ Editor is introduced which replaces
the current legacy editor. The new X++ Editor is based on hosting a Visual
Studio 2010 Editor Framework control. The new editor provides equivalent
functionality compared to the editor included in earlier Microsoft Dynamics AX
versions to make sure continued developer productivity and to meet current user
expectations.
Main advantages include:
Improves IntelliSense.
2-15
Feature Overview
The following features are added or updated to improve the X++ editor:
Insert scripts inline by typing the script name and then pressing
TAB.
Changes can be tracked because the code is last opened or last saved.
X++ Attributes
X++ classes and methods can now be decorated with metadata in the form of
attribute classes. An attribute class is any non-abstract class that inherits from the
SysAttribute class. Detailed metadata is assigned through the constructor of the
attribute class.
2-16
Chapter 2: MorphX
Scenario: Developer Experience
Isaac, the Developer, needs an editor to create code. The editor must have an
appropriate set of statement capabilities to enable editing code such as selecting,
navigating, and IntelliSense. In addition the editor will support the special
requirements of X++ development, such as integration with label subsystem,
source control, AOT, Cross-reference, help and the X++ compiler and debugger.
Use the following code sample in the following procedures.
static void main(Args _args)
{
CustTable custTable;
str custName;
;
select firstonly * from custTable;
if(custTable)
{
//Display customer name
custName = custTable.name();
info(strfmt("The customer name is %1.", custName));
}
info("Completed");
}
2-17
2-18
Chapter 2: MorphX
Procedure: Track Changes
To track changes within the X++ Editor, follow these steps:
1. Click the Toggle change tracking margin button in the X++ Editor
toolbar to turn on track margin.
2. Add a new variable called "str custAccountNum;"
3. Click the Save icon.
4. Verify it is possible to identify the code that has been changed since
the last save by viewing the glyph bar in the left side of the editor.
2-19
2-20
Chapter 2: MorphX
Scenario: Import .ald File
Isaac, the Developer, wants to make an .ald file part of the model. He wants to
import the label file into the model store.
2-21
2-22
Chapter 2: MorphX
2-23
Summary
Microsoft Dynamics AX 2012 is an innovative release that brings users improved
and new functionality. The following main concepts are introduced:
2-24
Chapter 2: MorphX
2-25
2.
3.
2-26
Chapter 2: MorphX
Solutions
Test Your Knowledge
1. True or false, in Microsoft Dynamics AX 2012 the reverse engineering tool
is enhanced to supports table inheritance and will automatically include
parent elements in the generated models.
() True - the reverse engineering tool supports table inheritance.
( ) False - the reverse engineering tool only supports class inheritance.
2. Which of the following are true statements about the new model repository in
Microsoft Dynamics AX 2012? (Select all that apply)
() The AOD files are now stored in the model store and old model store.
() The ALD files are now stored in the model store.
() The Help files are now rendered by the Help Server.
() Static files are either moved to the file system in the AOS instances,
or converted into standard Application Object Tree (AOT) resources.
3. Which of the following are advantages of the new Microsoft Dynamics AX
2012 X++ Editor? (Select all that apply)
() Better integration with MorphX tools, such as Cross reference.
( ) Increases the cost of adding editor tests because of the extension of
UIAutomation.
() Richer code rendering, such as better formatting and syntax coloring,
tooltips for labels and errors.
() Guidance during code writing, such as XML documentation on
parameter help.
4. True or false, in Microsoft Dynamics AX 2012, the setup program installs
the label (ALD) files on a file share.
( ) True - the label files are installed on the file share.
() False - the label files are installed as part of the model file.
2-27
2-28