RSS

Category Archives: Technical

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.

 

 
1 Comment

Posted by on July 22, 2011 in Technical

 

UnitOfWork in AX 2012

Hi All,

UnitOfWork is new class in AX 2012 which manages the database transaction sequence automatically,  During any Insert,Update and Delete developer need not to maintain the sequence.

In the past, the only way to perform insert’s, updates or deletes, a developer would have to take and make use of ttsBegin,ttsCommit & ttsAbort to perform such actions.

Below are the steps to be followed to work with UnitofWork.

Step 1 :  Create Sample Table called UnitofWorkSample.

Step 2 :  Write class “UnitofworkExample” with Static method called “unitofwork”.

Step : 3 Create X++ job to call static method in the class.

Step 4 :  Select table UnitofWorkSample and use Table Browse to see records inserted.

UnitOfWork class supports Update & Delete methods similar to Insert method.   This framework helps the developer to eliminates to keep transaction tracking.

Note :

  • UnitOfWork will run only on Server tier.
  • UnitOfWork class does not support Temporary  Table.
  • UnitOfWork requires optimistic concurrency
 
Leave a comment

Posted by on July 21, 2011 in Technical

 

Optimistic Concurrency Control in AX 2012

Optimistic Concurrency Control in AX 2012

Optimistic Concurrency Control helps to improve the database performance since the hold data for only short time during update.

Following are the advantages of using OCC:

  • Fewer resources are used to hold the locks during the update process.
  • Records are locked for a shorter length of time. •
  • Records remain available for other processes to update if they have been selected from the database but haven’t yet been updated.

Where to set this up?

Most of the standard application tables are OCC enabled.

  • Enable to Table properties OCCEnabled

  • Through X++ code

Note :  When data is updated or deleted by a client by using forms, the OccEnabled property change on the tables is ignored

 
Leave a comment

Posted by on July 21, 2011 in Technical

 

Working with Valid Time State Table in AX 2012

Working with Valid Time State Table in AX 2012

Step 1 :  Create New Table “ValidateDateExample”.

Step 2 : Select the Properties of the Table “ValidateDateExample”.

Step 3:  Change Properties “ValidateTimeStateFieldType”  values as “Date

 

 

 

 

 

 

Step 4 : Add String Field called “Name

Step 5 : Create Unique Index “ValidateIdx” with below fields

Step 6 : Change Index Prosperity as below

Step 7 : Add some sample data into Table

Step 8 : Use the Below Job to Select Records from table using ValidateTimeState

 
Leave a comment

Posted by on July 15, 2011 in Technical