最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

理解SQLDictionaryTable和AX数据同步 / Understanding SQLDictionaryTable and AX data synchronization

网络文摘 William 82浏览 0评论
今天我们将讨论SQL Server中对象的ID和SQLDictionary表。AX中的每个对象(主要是类,表和列,现在重点放在表和列上,因为这是在SQL Server中提交的内容)获取ID以识别它们。在AX 2012中,ID在ax系统中创建对象时分配(通过xpo导入,AOT中的新对象或模型导入)。
Today we will talk about the objects' IDs and SQLDictionary table from SQL Server. Each object in AX (mainly classes,  tables and the columns, with the emphasis placed on tables and columns right now, since that is what gets committed in SQL Server) gets an ID in order to identify them. In AX 2012 the ID is allocated at the moment of the object's creation in the ax system (either through a xpo import, new object in AOT, or model import). 现在,AX如何与SQL Server中的表一起使用?系统将采用AOT中的定义,并在SQL中提交(列,它们的名称,长度,类型)。到目前为止,一切正常,但AX如何跟踪它在SQL Server中的含义?匹配对象的名称就足够了?让我们来看看。

Now, how does AX works with the tables in the SQL Server? The system will take the definition in the AOT and will commit that (the columns, their name, lenght, type) in SQL. So far, everything is going ok, but how is AX keeping track of what it has in the SQL Server? Matching the names of the objects would be enough? Let's see.  SQL中的表可以与AX AOT中的名称匹配。因此,想象一下表名的变化,或者更容易,表格列的名称,从colA到colB。该表一旦更改,就不会引用该列本身已重命名。

 A table in SQL could be matched by it's name in the AX AOT. So, imagine that there is a change in a table's name, or easier, for the moment, a table column's name, going from colA to colB. The table, once changed, holds no reference that the column itself was renamed.  因此,当桌面上发生DD Sync进程时,SQL Server会发生什么?将保留旧的colA列并创建新的colB?初始列的值丢失了吗?
 So, when the DD Sync process happens on the table, what would happen in SQL Server? The old colA column will be kept and the new colB will be created? The values from the inital column lost? 这不是理想的结果。因此,这里出现了一个“系统”表,它实际上将保存有关AX已写入SQL Server的信息。该表称为  SQLDictionary ,它保存  AX对象名称,它们在SQL Server中的  名称以及它们的  AX ID 
This is not  a desired outcome. So, here comes into play a 'system' table, that will actually keep the information about what AX has written to SQL Server. The table is called SQLDictionary, and keeps the names of the AX objects, their names in SQL Server, and their AX IDs.  AX中的开发人员无法手动更改AX中的对象ID,因此该值可用于标识对象,以及是否更改了名称。现在,我们对上面的谜语有一个答案:如果一个列的名称发生变化,AX将在SQLDictionary中查找与AX中该列匹配的ID,并且根据它是否找到一个,将更新现有列(旧的)命名为新的)或创建一个新的(使用新名称)。

 An object's ID in AX can't be changed manually by a developer in the IDE, so this value can be used to identify the object, and if it's name was changed. So now, we have an answer to the riddle above: if a column's name changes, AX will look in the SQLDictionary for an ID matching that column in AX, and depending on if it finds one, will either update an existing column (the old name to the new one) or create a new one (with the new name).
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址