O'Reilly logo

Learning MS Dynamics AX 2012 Programming by Erlend Dalen, Mohammed Rasheed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unit of work

Though set-based operations work great when mass updating or deleting records, we get into a bit of a problem when mass inserting records into multiple tables that have a parent/child type relation, for example, transaction headers and transaction lines.

As an ID (key) is needed from the transaction header before transaction lines can be created, developers are forced to make multiple calls to the database within a large transaction block.

In Dynamics AX 2012, this problem was addressed by the UnitOfWork class.

UnitOfWork is a system class and is used to comment a number of records in a single transaction. The class is aware of the relationship between tables and can automatically fill in the related value fields. For example, transaction ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required