首页 > 解决方案 > .Net Core 3.1 中的 AsyncControllerActionInvoker 等效项

问题描述

我一直在尝试将一个项目从 MVC 迁移到 Core 3.1 并且有点卡住了。

类(在 mvc 中)使用AsyncControllerActionInvoker并覆盖该InvokeAction方法。由于这在 netcore 3.1 中不兼容,有没有办法在 netcore 3.1 中复制这种模式?

下面是示例代码:

public class ActionInvoker : AsyncControllerActionInvoker
{
    public override bool InvokeAction(ControllerContext controllerContext, string actionName)
    {
        this.InvokeActionWithActionResult(controllerContext, actionName); 
        // This custom function calls other methods in the controller such as BeginInvokeActionMethodWithFilters and EndInvokeActionMethodWithFilters
        return true;
    } 
}

标签: asp.net-mvcasp.net-coreasp.net-core-3.1controlleractioninvoker

解决方案


推荐阅读