AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 10.07.2012, 00:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
emeadaxsupport: Surrogate foreign keys in AIF
Источник: http://blogs.msdn.com/b/axsupport/ar...ys-in-aif.aspx
==============

Although the use of "natural keys" in place of surrogate foreign keys in AIF is a documented design change in AX 2012, it seems there are still some questions around this functionality.

Per the documentation (http://msdn.microsoft.com/en-us/library/gg879708.aspx)...

The document services framework "..replaces a surrogate foreign key (SFK) with the natural key for a specific table
relationship."



A simple example is the ContactForParty field in the DirContactPersonsService. This field in the ContactPerson table has an EDT of DirPartyRecId, but an error will occur if you attempt something like this...

AxdEntity_ContactPerson contactPerson = new AxdEntity_ContactPerson();

contactPerson.ContactForParty = dirpartyrecId;



This won't work with a recId value, because the service will determine that ContactForParty is a surrogate foreign key and will look for the natural (replacement) key on DirPartyTable. The replacement key on DirPartyTable is PartyNumberIdx, so what we need to pass in via the service is the PartyNumber.

The concept seems pretty simple in this example, but it can become more complex when the replacement key is itself a surrogate foreign key. The WorkerSalesResponsible field in SalesTable is one such example.
  • WorkerSalesResponsible is a SFK referring to HcmWorker.
  • The HcmWorker table has a replacement key of Person (HcmWorker_AK1)
  • Person is itself a SFK referring to DirPerson.
  • DirPerson extends DirPartyTable, and the replacement key on DirPartyTable is again, PartyNumberIdx.
  • So we finally have the natural key we need. To import data into the WorkerSalesResponsible field via the SalesSalesOrderService we need to use a valid PartyNumber.




Источник: http://blogs.msdn.com/b/axsupport/ar...ys-in-aif.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axdaily: Surrogate keys in AX 2012 Blog bot DAX Blogs 57 05.05.2011 14:57
emeadaxsupport: Creating an MSMQ message that can be consumed by AX AIF process Blog bot DAX Blogs 0 26.04.2010 19:05
emeadaxsupport: Error when trying to register the AIF services - "Cannot create a record in Data Policy Schema Information (AifDocumentField)" Blog bot DAX Blogs 0 29.03.2010 21:05
emeadaxsupport: What changes are required if we change the Business Connector Proxy used by AX 2009 Generated AIF Web services Blog bot DAX Blogs 0 29.03.2010 15:05
emeadaxsupport: Problems when trying to update a certain field with AIF Blog bot DAX Blogs 0 19.08.2009 18:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 08:10.