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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 10.02.2015, 19:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
palleagermark: Best Practice check for multiple models in the same layer
Источник: http://www.agermark.com/2015/02/best...le-models.html
==============

The Team Foundation Server integration in AX doesn't play very well with multiple models in the same layer. Without getting into too much detail, you for one thing risk having the unexpected elements deleted from the AOT when you synchronize.

I'm on a project where we work with a few different models in the same layer. We have dependencies to these models, developed elsewhere. We have one specific model for my project, which also is the model where we merge all conflicts between models. If we have something in an element, like a class or table, where sub elements belongs to another model, we move these sub elements into our model. So in these cases our model contains the sum of changes to the entire root element.

In order to not forget moving the sub elements, I have developed an extra Best Practice check to check if an element belongs to more than one model, and raise an error in that case. To resolve the error I have to move all sub elements into a single model.

Here is the code for the Best Practice check (it is what it is...):
public void checkMultipleModelsInSameLayer()
{
TreeNode treeNode = sysBPCheck.treeNode();
SysModelElement sysModelElement;
SysModelElement sysModelElementRoot;
UtilElements utilElement;
SysModelElementData sysModelElementData;
SysModel sysModel;
SysModelManifest sysModelManifest;
Set modelNameSet;
SetEnumerator modelNameSetEnumerator;
str modelNamesString;

if (versioncontrol.ideIntegration())
{
if (versioncontrol.parmSysVersionControlSystem() &&
!(versioncontrol.parmSysVersionControlSystem() is SysVersionControlSystemMorphX)) //MorphX VCS is not file based.
{
if (treeNode.treeNodeType().isUtilElement() && !SysTreeNode::hasSource(treeNode))
{
modelNameSet = new Set(Types::String);
utilElement = treeNode.utilElement();

// Only work with root objects
if (utilElement.parentId != 0)
{
return;
}

// Find the root model element
select firstonly RecId from sysModelElementRoot
where sysModelElementRoot.Name == utilElement.Name
&& sysModelElementRoot.ElementType == utilElement.RecordType
&& SysModelElementRoot.ParentId == 0;

// Analyse all children of the root, in the same layer
while select tableId from sysModelElement group by sysModelManifest.Name
where sysModelElement.RootModelElement == sysModelElementRoot.RecId
join tableId from sysModelElementData
where sysModelElementData.ModelElement == sysModelElement.RecId
join tableId from sysModel
where sysModel.RecId == SysModelElementData.ModelId
&& sysModel.Layer == currentAOLayer()
join Name from sysModelManifest
where sysModelManifest.Model == SysModel.RecId
{
modelNameSet.add(sysModelManifest.Name);
}

if (modelNameSet.elements() > 1)
{
modelNameSetEnumerator = modelNameSet.getEnumerator();
while (modelNameSetEnumerator.moveNext())
{
if (modelNamesString)
{
modelNamesString += ', ';
}

modelNamesString += modelNameSetEnumerator.current();
}

sysBPCheck.addError(0, 0, 0, strFmt('Object associated with several models in the same layer. Models: %1', modelNamesString));
}
}
}
}
}This method as added to relevant classes that extend SysBPCheckBase.


Источник: http://www.agermark.com/2015/02/best...le-models.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
palleagermark: Required check and update when deleting a backing entity for a financial dimension Blog bot DAX Blogs 0 13.11.2014 12:11
palleagermark: Exporting models from AX 2012 with .Net Runtime version 2.0 Blog bot DAX Blogs 1 05.12.2013 14:37
palleagermark: Check if two layer nodes are in fact equal Blog bot DAX Blogs 2 26.06.2012 14:12
sumitax: AX2009 – Best Practice Check for Classes Blog bot DAX Blogs 0 18.02.2011 17:11
mfp: Introducing AX models - Part 3 Blog bot DAX Blogs 0 16.10.2009 16:05

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 03:14.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.