-
Notifications
You must be signed in to change notification settings - Fork 7
MethodInterceptionAspect
Sagi edited this page Aug 10, 2015
·
6 revisions
An aspect that when applied on a method, intercepts invocations of this method.
In order to apply an aspect on a method 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 aspect for a subroutine (method that returns void in C# or Sub in VB) you will need to derive from ActionInterceptionAspect
and to derive from FunctionInterceptionAspect
for a function.
NCop supports methods that has up until 8 parameters:
For ActionInterceptionAspect
ActionInterceptionAspect
ActionInterceptionAspect<TArg1>
ActionInterceptionAspect<TArg1, TArg2>
ActionInterceptionAspect<TArg1, TArg2, TArg3>
ActionInterceptionAspect<TArg1, TArg2, TArg3, TArg4>
ActionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5>
ActionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>
ActionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>
ActionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>
For FunctionInterceptionAspect
FunctionInterceptionAspect<TResult>
FunctionInterceptionAspect<TArg1, TResult>
FunctionInterceptionAspect<TArg1, TArg2, TResult>
FunctionInterceptionAspect<TArg1, TArg2, TArg3, TResult>
FunctionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TResult>
FunctionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TResult>
FunctionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>
FunctionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>
FunctionInterceptionAspect<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TResult>