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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 01.12.2009, 21:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
How to add all descendant classes to a new project
Источник: http://alexvoy.blogspot.com/2009/12/...lasses-to.html
==============

I bumped into the problem of a class compilation with no licence for X++ source code.

Forward compile option is not enough to make my changes working. Thus I need to export-import all descendant classes as well as the class I changed - FormLetter in my case.

I therefore have to add all these classes to my project. Natural laziness saved me again from this manual work.

I hope this short job inspired by system class SysCompilerOutput and miklenew's job from AXForum will help you in similar situations.


X++:
// add to a new project all descendant classes for forward compilation
public static void SISCreateCompileForwardProject(Args _args)
{
   #AOT
   str                     project = 'SIS_CompileForward';
   SysCompilerOutput       sysCompilerOutput;
   Dictionary              dictionary      = new Dictionary();
   DictClass               dictClass       = new DictClass(className2Id("Formletter"));
   int                     numOfClasses    = dictionary.classCnt();
   ProjectNode             sharedProjects;
   ProjectNode             newProject;

   void addToProjectForwardClass(DictClass _dictClass, Dictionary _dictionary, int _numOfClasses)
   {
   ClassNode           classNode;
   DictClass           dictClassLoop;
   DictClass           childClass;
   int                 i;
   ;
       if (_dictClass)
       {
           classNode = infolog.findNode(#ClassesPath + #AOTDelimiter + _dictClass.name());

           if (classNode)
           {
               newProject.addUtilNode(UtilElementType::Class, classNode.name());

               for (i=1; i <= _numOfClasses; i++)
               {
                   dictClassLoop = _dictionary.classObject(_dictionary.classCnt2Id(i));

                   if (dictClassLoop.extend() == _dictClass.id())
                   {
                       childClass = new DictClass(dictClassLoop.id());
                       addToProjectForwardClass(childClass, _dictionary, _numOfClasses);
                   }
               }
           }
       }
   }
   ;

   sharedProjects = infolog.projectRootNode().AOTfindChild('Shared');
   sharedProjects.AOTAdd(project);
   newProject =  sharedProjects.AOTfindChild(project);
   newProject.loadForInspection();
   newProject = newProject.getRunNode();
   addToProjectForwardClass(dictClass, dictionary, numOfClasses);
   newProject.AOTsave();


}
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Dynamics Mobile: How to code your own barcode enabled tasklets (Motorola and Intermec devices) Blog bot DAX Blogs 1 03.06.2014 06:34
chrisfie: Project Server 2007 TechNet Webcasts recordings and decks Blog bot DAX Blogs 0 21.07.2009 10:05
Передача функции в качестве параметра lemchey_white DAX: Программирование 20 21.01.2008 22:51
axStart: How to work with big projects with multi add-ons Blog bot DAX Blogs 0 30.12.2007 16:30

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

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

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