RSS

UnitOfWork in AX 2012

21 Jul

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

 

Leave a comment