1
我有BaseController:重写查看错误递归
public partial class BaseController : Controller
{
protected override ViewResult View(string viewName, string masterName, object model)
{
return View(viewName, model);
}
}
,我会在未来改变这种观的逻辑。而且我还有一个控制器:
public partial class BrandController : BaseController
{
public virtual ActionResult Index()
{
return base.View(Views.Index,"", new Model()
{
);
}
我只是试图调用覆盖的方法在我BaseController和BaseController应该返回视图()。但是我在重写的View()方法中出现了递归错误。
我知道。但我需要一些解决方案和解释为什么是这样)) –
@Andjey因为你告诉它这样做。调用View(...)时执行的代码基本上只是说“再次呼叫我”。所以它再次被调用,并执行相同的代码,它说“再次打电话给我”。如果'View(...)'应该返回一个类型为'ViewResult'的新对象,请尝试'返回新的ViewResult()'。 – Wilsu
但我需要传递参数。 –