最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

多个事件的事件处理程序 / Event handler for multiple events

网络文摘 William 967浏览 0评论
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.
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址