2009-01-27 65 views
1

我在ASP.NET MVC自定义视图引擎,因为升级到RC1实现地区as in this post by Phil Haack不进入覆盖方法FindView我的自定义视图引擎,从而打破了应用程序无法找到它们的区域内的任何控制器。据我所知,有很多人在他们的MVC应用程序中使用区域,任何人都知道这个问题的解决方案或者它为什么会发生?ASP.NET MVC RC1 - 自定义视图引擎领域 - FindView覆盖不点火

以下是我的findview方法供参考。

public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName) 
    { 
     ViewEngineResult areaResult = null; 

     if (controllerContext.RouteData.Values.ContainsKey("area")) 
     { 
      string areaViewName = FormatViewName(controllerContext, viewName); 
      areaResult = base.FindView(controllerContext, areaViewName, masterName); 
      if (areaResult != null && areaResult.View != null) 
      { 
       return areaResult; 
      } 
      string sharedAreaViewName = FormatSharedViewName(controllerContext, viewName); 
      areaResult = base.FindView(controllerContext, sharedAreaViewName, masterName); 
      if (areaResult != null && areaResult.View != null) 
      { 
       return areaResult; 
      } 
     } 

     return base.FindView(controllerContext, viewName, masterName); 
    } 

回答

2

他们已经为FindView方法添加了一个参数。您现在可以在FindView和FindPartialView上指定usecache。

+0

只注意到自己的DLL文件没有正确地更新和额外的参数没有被注意到。现在尝试。 – Odd 2009-01-28 00:18:07

0

顺便说一句,菲尔已经更新了他的职位,与RC1合作。 Check here