tags:

views:

1071

answers:

3

Hi,

I have a custom view engine in ASP.NET MVC and since upgrading to RC1 my custom view engine that implements Areas as in this post by Phil Haack does not enter the override method FindView, thus breaking any controllers that sit within an area as the application is unable to find them. As I'm aware that a good number of people are using areas in their MVC applications, is anyone aware of a solution to this problem or why it happens?

Below is my findview method for reference.

    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);
    }
+1  A: 

They have added a parameter to the FindView Method. You can now specify to usecache on both FindView and FindPartialView.

Simon Laroche
Just noticed that myself, the DLL files didn't update correctly and the extra parameter wasn't noticed. Trying it now.
Odd
Nice one, looks like that was it. To any other users, make sure you follow the upgrade procedure in the release notes and update your DLLs and change your web.config in the views folder.
Odd
be sure to read the release notes. some really cool stuff in there!
Simon_Weaver
A: 

i have same problem just cant override

public override ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName)

and what usecache param exactly do?

any ideas

msony
A: 

And by the way, Phil has updated his post to work with RC1. Check here

Pita.O