0

我正在我的网站上为 MVC 2 设置 T4MVC。我收到 2 个构建错误:

在 T4MVC.cs 中,“RenderAction”方法没有重载需要 3 个参数

在 T4MVC.cs 中,方法 'Action' 没有重载需要 3 个参数

这些是 T4MVC.cs 文件中的内容:

public static void RenderAction(this HtmlHelper htmlHelper, ActionResult result) {
            var callInfo = result.GetT4MVCResult();
            htmlHelper.RenderAction(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary);
        }

    public static MvcHtmlString Action(this HtmlHelper htmlHelper, ActionResult result) {
        var callInfo = result.GetT4MVCResult();
        return htmlHelper.Action(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary);
    }

谢谢

4

1 回答 1

1

这很奇怪,因为这些重载存在于 System.Web.Mvc.Html.ChildActionExtensions 上,它是 MVC 的一部分:

public static class ChildActionExtensions {
    public static MvcHtmlString Action(this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues);
    public static void RenderAction(this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues);
}

在 T4MVC.cs 的顶部,应该有一个“使用 System.Web.Mvc.Html”,它使这些扩展方法可用。

您可以在自己的代码中调用这些相同的重载吗?

于 2010-04-29T21:59:34.417 回答