views:

23

answers:

1

Hi Is it possible to use a custom action invoker without having to instantiate it in the Controller handler factory? For example

//in Custom controller factory

         IController IControllerFactory.CreateController(RequestContext reqContext, string controllerName)
        {
                 var controller = base.CreateCOntroller(reqContext,controllerName ) as Controller;

                  controller.ActionInvoker = new CustomActionInvoker();
        }

Or is there another way I can execute an MVC action without having to use a Custom action invoker?

//Updating the question I have a Controller, say HomeController and Index action. Index is the main action in the controller. Once the Index action get executed, the MVC View will fire multiple actions using Ajax - GET requests (we using jTemplates).

For example //Controller public ActionResult Index() //main action and View {}

     public ActionResult AjaxAction1(string id);
     public ActionResult AjaxAction2();
     public ActionResult AjaxAction3(); 

Now I want to filter some of these actions not to execute depending on certain scenarios. For example I want to stop executing AjaxAction1 when the id is equal to 2.

Back to my original question. Is there a way to achieve this without using the action invoker. The reason that i don't want to use the action invoker is the way my project being structured ended up with circular references.

Any ideas greatly appreciated.

+1  A: 

Found the answer you can subclass the Controller and create the ControllerActionInvoker there.

Domi