Wednesday, 8 January 2014

Models and Model Files in AX 2012

SQL Server-based Model Store

The earlier release of Microsoft Dynamics AX stores the metadata in the application files which is AOD files.   In AX 2012 all the file based AOD files are replaced by SQL Server database based, which are called by Model Store.

Models and Model Files

Models are logical group of element like tables and classes.   In AX 2012 elements can be group and store in the model file.  Model files are easy to create, export, import and this can be uninstalled from the system when not required.
Models can manage through following tools.
  1. AXUtil.exe command-line utility.
  2. Programmatically; using axutilib.dll
  3. PowerShell.
Creating Model

Step 1: Click Start ->Click Run ->type “cmd” and Press End; you will get command prompt screen.


Step 2 : Type following command in command prompt.

“c:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\Bin” 



Basically we are changing current directory to AOS Server folder.  The above path will change depends upon your current installation.

Step 3: Type following command in command prompt.
         AxUtil.exe create /model:CustCustomer /layer:USR
 
 Basically using AxUtil we are creating model name call “CustCustomer” in USR Layer
After successful creation of model file; you will see below out in command prompt.




Changing Current Model in AX
 Step 4: Click on Current Model in the status bar; system will display all the model available in current layer.
 

List of model available in Current Layer


Step 5:  Select “Cust Customer” model and click ok.
(System will change current model in the status bar; refer below screen shot)


Creating/Changing Object in current Model

Step 6:  Create Table called “ModelExample” and Save the table.

Step 7: Right click on “ModelExample” Table and select Properties.  In the properties you can notice that newly created object belongs to “CustCustomer” model



Exporting Model

Step 8: Type following command in command prompt.

AxUtil.exe export /file:c:\CustCustomerModel.axmodel /model:CustCustomer
You will see following output message in the screen.



Confirm Model files exported correctly by verifying physical folder

c

Uninstalling Model

Step 9: Type following command in command prompt.
              AxUtil.exe delete /model:CustCustomer 

You will see following output message in the screen



Check Object Model in AX, You will not see the CustCustomer Model in Model List window.  All the object belongs to this model will be deleted from AOT.






 



Export an .axmodel file (Windows PowerShell)

  1. On the Start menu, point to All Programs, point to Administrative Tools, and then click Microsoft Dynamics AX Management Shell.
  2. At the Windows PowerShell command prompt, PS C:\>, type the following command, and then press ENTER.
    Export Command Syntax :
    Export-AXModel –Model <name> -File <Filename.axmodel>
    Example : 
    Export-AXModel –Model SecurityModel -File C:\SecurityModel.axmodel


Import an .axmodel file (Windows PowerShell)
    1. On the Start menu, point to All Programs, point to Administrative Tools, and then click Microsoft Dynamics AX Management Shell.
    2. At the Windows PowerShell command prompt, PS C:\>, type the following command, and then press ENTER.
    Import Command Syntax :
    Install-AXModel -File <Filename.axmodel> -Details
    Exmaple :
    Install-AXModel -File C:\SecurityModel.axmodel -Details

No comments:

Post a Comment