views:

370

answers:

1

Hi. Does anyone know of a way to get hold of the intercepted parameters sent into a method.

For instance...

You have an Update method inside a CustomerService like this.. Update(Customer c) ..and you want to get hold of the Customer object sent into the service.

Does it come out of the box in any way or do I have to do anything else except the "usual" interception.

/J

+2  A: 

Assuming you are using the latest version of Ninject, you should be able to grab them from the interceptors BeforeInvoke invocation 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 provided in the Request field to help you determine things like Generic arguments etc..