-->

Are RecIds unique across Common tables in Dynamics

2019-01-27 01:52发布

问题:

Are the RecIds unique across Common tables in AX 2012? I read that this is version dependent, but I did not manage to find any information on this for AX 2012.

If not, doesn't that break polymorphic design of the tables in AX, where all AX tables extend from Common? And Common declares RecId...

回答1:

When Microsoft Dynamics AX inserts records into SQL tables, a unique RecId is assigned to each record regardless of the company each record is associated with. The field is 64 bit long and unique per table.

In Axapta 3.0 and below RecIds were unique per company account and 32 bit long. Thus a company could have no more than 4 billion records as the RecId could be negative.

Polymorphic design? I am not sure what you mean in this context, but given a RecId you do not know which table it belongs to, and you need that information in order to find the record:

public Common findRecord(TableId _tableId, RecId _recId) 
{
    Common record = new DictTable(_tableId).makeRecord();
    select record where record.RecId == _recId; 
    return record; 
}

In SQL no table is called Common. It is an AX concept, you may consider it an interface containing methods only.



标签: axapta x++