Would it be worth to remove the .aspx/.ascx lookup if I don't plan to use them?
Now that MVC 3 Preview 1 here, we can use Razor (.cshtml) view engine. If a view not found, I get this error:
The view 'a' or its master was not found. The following locations were searched:
~/Views/Home/a.aspx
~/Views/Home/a.ascx
~/Views/Shared/a.aspx
~/Views/Shared/a.ascx
~/Views/Home/a.cshtml
~/Views/Shared/a.cshtml
Would it be worth to remove the .aspx/.ascx lookup, if I don't 开发者_Go百科plan to use them?
I doubt you would gain any noticeable performance gain from that. It's merely a file check and if it's also cached by the engine there's hardly any performance improvement. I'd call it micro-optimization!
I guess if you know you won't be using WebForms, you could just remove it from the list of view engines, like so:
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
That way it won't check for aspx/ascx files.
The Code has been revised:
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
精彩评论