Persistent Data Storage Design Pattern [AX 2012]
Updated: March 16, 2011
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
When working with persistent storage not described in the Data Dictionary, add version control features to read previously saved data to be read later when the structure is changed.
Whenever you save data persistently in structures unknown to the Data Dictionary (such as contents of containers in the database or data in flat files on a disk), add a version number to the structure as the first entry.
When you write data, set the initial version number to 1. When you later modify the structure, it should still be possible to read the old structure and increment the version number. Make it possible to also read the new structure.
When reading data, process it based on the version number found as the first entry.
If you read data older than the current version, interpret it as best you can, or, if you cannot use it in any meaningful way, abort the operation with a meaningful message to the user.
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.