Skip to content

Instantly share code, notes, and snippets.

@peter3
Forked from jbogard/Featurefolders.cs
Last active June 28, 2019 17:24
Show Gist options
  • Save peter3/69abf1cb0ebbb2a8b392065fe0202500 to your computer and use it in GitHub Desktop.
Save peter3/69abf1cb0ebbb2a8b392065fe0202500 to your computer and use it in GitHub Desktop.
Feature folders
public class FeatureViewLocationRazorViewEngine : RazorViewEngine
{
public FeatureViewLocationRazorViewEngine() {
var featureFolderViewLocationFormats = new[] {
"~/Features/{1}/{0}.cshtml",
"~/Features/Shared/Views/{0}.cshtml"
};
ViewLocationFormats = featureFolderViewLocationFormats;
MasterLocationFormats = featureFolderViewLocationFormats;
PartialViewLocationFormats = featureFolderViewLocationFormats;
}
}
/* in global.asax */
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new FeatureViewLocationRazorViewEngine());
@peter3
Copy link
Author

peter3 commented Jun 28, 2019

simplified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment