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

Subscribing to onValidatingWrite

网络文摘 msmfp 838浏览 0评论

Most event handlers are straight forward. One exception is when subscribing to a table’s onValidated and onValidating events.

The trick is to realize that the DataEventArgs instance passed to the event handler, is a validateEventArgs – a specialization of DataEventArgs.

Here is a template to use:

[DataEventHandler(tableStr(<TableName>), DataEventType::ValidatingWrite)]
public static void <TableName>_onValidatingWrite(Common _sender, DataEventArgs _e)
{
    boolean result = true;
    ValidateEventArgs validateEventArgs = _e as ValidateEventArgs;
    <TableName> <table> = _sender as <TableName>;
    if (<validation>)
    {
        result = checkFailed(“Validation failed”);
    }
    validateEventArgs.parmValidateResult(result);
}

 

The platform will keep raising the onValidating events until an event handler returns a negative result.

Here is a great post with more examples: Access stuff in the new event subscriptions

 

THIS POST IS PROVIDED AS-IS; AND CONFERS NO RIGHTS.

发表我的评论
取消评论

表情

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

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