Показать сообщение отдельно
Старый 20.03.2008, 14:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
axStart: Always add str tostring() method on your class for debug purpose.
Источник: http://axstart.spaces.live.com/Blog/...C0A0!285.entry
==============


Did you ever wonder how the debug is able to add watches on object?
Sometimes you get additional information like on the class QueryBuildRange. But on your own class you get nothing. The reason is that you did not implement the tostring method on your class. Lets do this example:
str tostring()
{
    sysdictclass sdt = new sysdictclass(classnum(class1));//hard coded because AX has no WhoAmI method
    sysdictclass extendsSdt = new sysdictclass(sdt.extend());
    str result;
    ;
    result = strfmt('%1 | ',sdt.toString());
    if(extendsSdt)
    {
        result += strfmt('extends %1 | ',extendsSdt.toString());
    }
    result += strfmt('run on %1',xglobal::clientKind());//also possible to se with the icon in the debugger in AX 4.0
    return result;
}
 
Now you are able to se what kind of class is used. This is just an example but from now, you can make everything visible in the debugger.


Источник: http://axstart.spaces.live.com/Blog/...C0A0!285.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.