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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 21.05.2009, 12:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
SysDictCoder: Detecting default values
Источник: http://sysdictcoder.com/blog/detecting-default-values/
==============

So I haven’t posted in a long time. I finally fixed some technical issues on the blog and upgraded to a recent version of Wordpress. Let’s start with a quick tip to warm up :)

As you know X++ supports methods with default values. In Ax it’s possible to detect when such a default value was used at runtime with prmIsDefault(). To see this for yourself, create a class with a method like this:

void someMethod(int i = 1) { ; if (prmIsDefault(i)) { info('Default'); } else { info('Value given'); } }

And call it from another method.

o.someMethod(); o.someMethod(1);

Even though the value is the same in both cases a different info message will be displayed.

Now you may be wondering how this can be useful. Some scenarios:

  • Avoiding expensive operations if the default value was used
  • Avoiding unwanted initializations
  • Dealing with customizations that require extra parameters in standard Ax classes
If you do a search for prmIsDefault() in the AOT you will see it’s used often. Classes with the Ax prefix are the most obvious example. Because getters and setters are rolled into a single method it’s necessary to know if the method was used as a getter or a setter and keep track of modified fields.



Источник: http://sysdictcoder.com/blog/detecting-default-values/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
SysDictCoder: Changing properties of AOT objects in code Blog bot DAX Blogs 0 04.05.2009 20:05
axaptapedia: Packing date range values in queries Blog bot DAX Blogs 1 09.11.2007 13:10
Ошибка SQL в модуле "Расчеты с персоналом" Карбофос DAX: Функционал 5 02.08.2002 12:44
Ошибка SQL в модуле "Расчеты с персоналом" Карбофос DAX: Программирование 0 31.07.2002 17:20

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

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

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