dependency injection - Glimpse 1.4.2, Castle.Windsor 3.0 and custom ASP.NET MVC 3 ControllerActionInvoker -


i've created custom controlleractioninvoker per http://ialekseev.blogspot.co.uk/2012/10/dependency-injection-in-aspnet-mvc-3.html castle.windsor can resolve dependencies in custom actions.

i've noticed though explicitly resolve controlleractioninvoker in controller factory, when use glimpse, isn't being executed:

public class windsorcontrollerfactory : defaultcontrollerfactory     {         private readonly ikernel kernel;          public windsorcontrollerfactory(ikernel kernel)         {             this.kernel = kernel;         }          public override void releasecontroller(icontroller controller)         {             kernel.releasecomponent(controller);         }          protected override icontroller getcontrollerinstance(requestcontext requestcontext, type controllertype)         {             if (controllertype == null)             {                 throw new httpexception(404, string.format("the controller path '{0}' not found.", requestcontext.httpcontext.request.path));             }              var controller = kernel.resolve(controllertype) controller;              // resolve new action invoker             if (controller != null)             {                 controller.actioninvoker = kernel.resolve<iactioninvoker>();             }              return controller;         }     } 

heres action invoker extentsion method inject properties:

public class windsoractioninvoker : controlleractioninvoker {     private readonly ikernel kernel;      public windsoractioninvoker(ikernel kernel)     {         this.kernel = kernel;     }      protected override actionexecutedcontext invokeactionmethodwithfilters(             controllercontext controllercontext,             ilist<iactionfilter> filters,             actiondescriptor actiondescriptor,             idictionary<string, object> parameters)     {         foreach (iactionfilter actionfilter in filters)         {             // extension method             kernel.injectproperties(actionfilter);         }         return base.invokeactionmethodwithfilters(controllercontext, filters, actiondescriptor, parameters);     } } 

hence i'm seeing object reference errors thrown in actions types i'm expecting castle.windsor inject in:

public class checkcountryfilter : actionfilterattribute {     public iappsettings settings { get; set; }     public ilookupservice lookupservice { get; set; }     public ilogger logger { get; set; }      public override void onactionexecuting(actionexecutingcontext filtercontext)     {         // logger null!        if (logger.isdebugenabled) 

i think glimpse somehow proxying away controller.actioninvoker, replacing mine own?

is there away can make glimpse play nice custom controlleractioninvoker?

strangely, glimple worked on first run, i'm stuck these errors!

found post on github - https://github.com/glimpse/glimpse/issues/328 - seemed report similar issues. ignoring executioninspector glimpse work , invoker resolves dependencies lose @ lot of useful info out of glimpse!

is option?


Comments