MethodInvocation
NexusLabs.Needlr¶
NexusLabs.Needlr¶
MethodInvocation Class¶
Default implementation of IMethodInvocation used by generated interceptor proxy classes.
Inheritance System.Object 🡒 MethodInvocation
Implements IMethodInvocation
Constructors¶
MethodInvocation(object, MethodInfo, object[], Func<ValueTask<object>>) Constructor¶
Initializes a new instance of the MethodInvocation class for non-generic methods.
public MethodInvocation(object target, System.Reflection.MethodInfo method, object?[] arguments, System.Func<System.Threading.Tasks.ValueTask<object?>> proceed);
Parameters¶
target System.Object
The target service instance.
method System.Reflection.MethodInfo
The method being invoked.
arguments System.Object[]
The arguments passed to the method.
proceed System.Func<System.Threading.Tasks.ValueTask<System.Object>>
A function that invokes the next interceptor or the actual method.
MethodInvocation(object, MethodInfo, object[], Type[], Func<ValueTask<object>>) Constructor¶
Initializes a new instance of the MethodInvocation class.
public MethodInvocation(object target, System.Reflection.MethodInfo method, object?[] arguments, System.Type[] genericArguments, System.Func<System.Threading.Tasks.ValueTask<object?>> proceed);
Parameters¶
target System.Object
The target service instance.
method System.Reflection.MethodInfo
The method being invoked.
arguments System.Object[]
The arguments passed to the method.
genericArguments System.Type[]
The generic type arguments (empty for non-generic methods).
proceed System.Func<System.Threading.Tasks.ValueTask<System.Object>>
A function that invokes the next interceptor or the actual method.
Properties¶
MethodInvocation.Arguments Property¶
Gets the arguments passed to the method. The array can be modified to change argument values before calling ProceedAsync().
Implements Arguments
Property Value¶
MethodInvocation.GenericArguments Property¶
Gets the generic type arguments if the method is a generic method. Returns an empty array for non-generic methods.
Implements GenericArguments
Property Value¶
MethodInvocation.Method Property¶
Gets metadata about the method being invoked.
Implements Method
Property Value¶
MethodInvocation.Target Property¶
Gets the target service instance on which the method is being invoked.
Implements Target
Property Value¶
Methods¶
MethodInvocation.ProceedAsync() Method¶
Proceeds to the next interceptor in the chain, or to the actual method implementation if this is the last interceptor.
Implements ProceedAsync()
Returns¶
System.Threading.Tasks.ValueTask<System.Object>
The result of the method (or the result from the next interceptor).
Returns null for void methods.