Ninject AOP - parameters of the receive method from the intercepted method
Does anyone know a way to capture the intercepted parameters sent to the method.
For example...
You have an Update method inside a CustomerService like this. Update (Customer c) ... and you want to get the Customer object posted to the service.
Is this out of the box anyway or do I need to do something other than "normal" interception.
/ J
+2
Johan
source
to share
1 answer
Assuming you are using the latest version of Ninject, you should grab them from the InvInvoke intercept parameter (if your interceptor inherits from SimpleInterceptor)
protected override void BeforeInvoke(Ninject.Core.Interception.IInvocation invocation)
{
foreach (var arg in invocation.Request.Arguments)
log.Message(arg.ToString());
}
There are also some other properties in the Request field to help you define things like general arguments, etc.
+3
source to share