Skip to content

Instantly share code, notes, and snippets.

@jbogard
Created October 3, 2013 15:55
Show Gist options
  • Save jbogard/6812184 to your computer and use it in GitHub Desktop.
Save jbogard/6812184 to your computer and use it in GitHub Desktop.
Feature folders
public class FeatureViewLocationRazorViewEngine : RazorViewEngine
{
public FeatureViewLocationRazorViewEngine()
{
ViewLocationFormats = new[]
{
"~/Features/{1}/{0}.cshtml",
"~/Features/{1}/{0}.vbhtml",
"~/Features/Shared/{0}.cshtml",
"~/Features/Shared/{0}.vbhtml",
};
MasterLocationFormats = ViewLocationFormats;
PartialViewLocationFormats = new[]
{
"~/Features/{1}/{0}.cshtml",
"~/Features/{1}/{0}.vbhtml",
"~/Features/Shared/{0}.cshtml",
"~/Features/Shared/{0}.vbhtml",
};
}
}
/* in global.asax */
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new FeatureViewLocationRazorViewEngine());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment