OverrideInvoke(dynamic)
Template method for overriding event invocation behavior, executed once per handler when the event is raised.
Declaration
[Template(IsEmpty = true)]
public virtual dynamic? OverrideInvoke(dynamic handler)Parameters
| Type | Name | Description |
|---|---|---|
| dynamic | handler | The specific event handler being invoked. Use |
Returns
| Type | Description |
|---|---|
| dynamic | The return value from invoking the handler (typically |
Remarks
This template method is optional (marked with [Template(IsEmpty = true)]). If not overridden,
handlers are invoked directly without interception.
This template is invoked once for each registered handler when the event is raised. For example, if there are 3 event handlers and the event is raised once, this template will be called 3 times. This enables per-handler interception patterns such as exception handling with handler removal, async execution, or handler filtering.
Use meta.Proceed() to invoke the actual handler. Within the template, you can access event metadata via
meta.Target.Event and remove handlers programmatically using
meta.Target.Event.Remove(handler).
Note that meta.Target.Event.Raise() is not
supported from this template; you must use meta.Proceed().