Massively simplifies the RenderActionInvoker which will support the native MVC caching and both async and non async support. U4-7270 Async Index actions for controllers implementing IRenderMvcController do not render view correctly
This commit is contained in:
@@ -11,10 +11,7 @@ namespace Umbraco.Web.Mvc
|
||||
/// Ensures that if an action for the Template name is not explicitly defined by a user, that the 'Index' action will execute
|
||||
/// </summary>
|
||||
public class RenderActionInvoker : AsyncControllerActionInvoker
|
||||
{
|
||||
|
||||
private static readonly ConcurrentDictionary<Type, ActionDescriptor> IndexDescriptors = new ConcurrentDictionary<Type, ActionDescriptor>();
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// Ensures that if an action for the Template name is not explicitly defined by a user, that the 'Index' action will execute
|
||||
/// </summary>
|
||||
@@ -32,16 +29,8 @@ namespace Umbraco.Web.Mvc
|
||||
//check if the controller is an instance of IRenderMvcController
|
||||
if (controllerContext.Controller is IRenderMvcController)
|
||||
{
|
||||
var methodInfo = controllerContext.Controller.GetType().GetMethods()
|
||||
.First(x => x.Name == "Index" &&
|
||||
x.GetCustomAttributes(typeof (NonActionAttribute), false).Any() == false);
|
||||
|
||||
ad = typeof (Task).IsAssignableFrom(methodInfo.ReturnType)
|
||||
? new TaskAsyncActionDescriptor(methodInfo, "Index", controllerDescriptor)
|
||||
: (ActionDescriptor) new ReflectedActionDescriptor(methodInfo, "Index", controllerDescriptor);
|
||||
|
||||
return IndexDescriptors.GetOrAdd(controllerContext.Controller.GetType(), type => ad);
|
||||
}
|
||||
return controllerDescriptor.FindAction(controllerContext, "Index");
|
||||
}
|
||||
}
|
||||
return ad;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user