Показать сообщение отдельно
Старый 22.01.2019, 17:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
goshoom: Event handler for multiple events
Источник: http://dev.goshoom.net/en/2019/01/ev...ltiple-events/
==============

I’m not sure that everybody is aware that a single event handler method (in Dynamics 365 for Finance and Operations) can be decorated with several event handler attributes.

For example, a common method can handle both inserts and updates.

[ DataEventHandler(tableStr(MyTable), DataEventType::Inserted), DataEventHandler(tableStr(MyTable), DataEventType::Updated)]public static void myHandler(Common _sender, DataEventArgs _e)






Or it can handle similar events from different sources, such as different tables:

[ DataEventHandler(tableStr(InventItemSalesSetup), DataEventType::Inserting), DataEventHandler(tableStr(InventItemPurchSetup), DataEventType::Inserting), DataEventHandler(tableStr(InventItemInventSetup), DataEventType::Inserting)]public static void myHandler(Common sender, DataEventArgs e){ InventItemOrderSetupMap inventSetup = sender; ...}






If you want to run the same logic, simply using the same method makes good sense.



Источник: http://dev.goshoom.net/en/2019/01/ev...ltiple-events/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.