-
Notifications
You must be signed in to change notification settings - Fork 7
Event aspects
An Aspect that, when applied on an event, intercepts invocations of its Add, Remove and the actual invocation.
In order to apply an aspect for an event the first thing you need to do is write the aspect itself.
You need to create a class that derives from one of these types:
NCop differentiates between functions and subroutines the same way as the .NET delegates (System.Func<T>, System.Action
).
If you want to create an event aspect for a subroutine (method that returns void in C# or Sub in VB) you will need to derive from EventActionInterceptionAspect
and to derive from EventFunctionInterceptionAspect
for a function event.
NCop supports events that has up until 8 parameters:
For EventActionInterceptionAspect
EventActionInterceptionAspect
EventActionInterceptionAspect<TArg1>
EventActionInterceptionAspect<TArg1, TArg2>
EventActionInterceptionAspect<TArg1, TArg2, TArg3>
EventActionInterceptionAspect<TArg1, TArg2, TArg3, TArg4>
EventActionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5>
EventActionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>
EventActionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>
EventActionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>
For EventFunctionInterceptionAspect
EventFunctionInterceptionAspect<TResult>
EventFunctionInterceptionAspect<TArg1, TResult>
EventFunctionInterceptionAspect<TArg1, TArg2, TResult>
EventFunctionInterceptionAspect<TArg1, TArg2, TArg3, TResult>
EventFunctionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TResult>
EventFunctionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>
EventFunctionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>
EventFunctionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>
EventFunctionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>