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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.12.2015, 11:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
mfp: X++ in AX7: Static event subscription
Источник: http://blogs.msdn.com/b/mfp/archive/...scription.aspx
==============
In AX2012 we introduced events. Unfortunately, we got the subscription part of static events upside down. In the meta model you were forced to change the publisher when adding a subscriber. This resulted in an intrusive customization. And thus defeats most of the purpose.

In AX7 this has been corrected. You can now subscribe to events using the SubscribesTo attribute.

Extending the singleton example from my previous post, we can now implement the flush method.

class MyClass
{
static MyClass singleton;

public MyClass getInstance()
{
...
}

[subscribesTo(classStr(SysTest), delegateStr(SysTest, postInvokeTearDown)]
public static void flush()
{
singleton = null;
}
}


Note: Subscribing to the SysTest.postInvokeTearDown event to flush a singleton is overkill. This event will fire for all tests, and thus slow down every test execution (a little bit). An alternative implementation could be to use dynamic event subscription to only hook up the event as needed. Dynamic event subscriptions work in exactly the same way as in AX2012.



THIS POST APPLIES TO MICROSOFT DYNAMICS AX7 PREVIEW; IS PROVIDED AS-IS AND CONFERS NO RIGHTS.







==============
Источник: http://blogs.msdn.com/b/mfp/archive/...scription.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Теги
ax7

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
mfp: X++ in AX7: Client/Server keywords Blog bot DAX Blogs 23 15.12.2015 09:09
mfp: X++ in AX7: Static members Blog bot DAX Blogs 4 11.12.2015 11:38
mfp: X++ in AX7 Blog bot DAX Blogs 0 02.12.2015 22:13
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
CRM DE LA CREME! Some more useful javascripts for MS CRM Blog bot Dynamics CRM: Blogs 0 04.05.2010 11:05

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

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

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