/// <summary> /// Creates an action invoker. /// </summary> /// /// <returns> /// An action invoker. /// </returns> protected virtual IActionInvoker CreateActionInvoker() { IAsyncActionInvokerFactory service1 = Resolver.GetService <IAsyncActionInvokerFactory>(); if (service1 != null) { return(service1.CreateInstance()); } IActionInvokerFactory service2 = Resolver.GetService <IActionInvokerFactory>(); if (service2 != null) { return(service2.CreateInstance()); } return(Resolver.GetService <IAsyncActionInvoker>() ?? Resolver.GetService <IActionInvoker>() ?? new AsyncControllerActionInvoker()); }
protected virtual IActionInvoker CreateActionInvoker() { // Controller supports asynchronous operations by default. // Those factories can be customized in order to create an action invoker for each request. IAsyncActionInvokerFactory asyncActionInvokerFactory = Resolver.GetService <IAsyncActionInvokerFactory>(); if (asyncActionInvokerFactory != null) { return(asyncActionInvokerFactory.CreateInstance()); } IActionInvokerFactory actionInvokerFactory = Resolver.GetService <IActionInvokerFactory>(); if (actionInvokerFactory != null) { return(actionInvokerFactory.CreateInstance()); } // Note that getting a service from the current cache will return the same instance for every request. return(Resolver.GetService <IAsyncActionInvoker>() ?? Resolver.GetService <IActionInvoker>() ?? new AsyncControllerActionInvoker()); }