Skip to content

Instantly share code, notes, and snippets.

@jmcd
Created May 11, 2012 14:30
Show Gist options
  • Save jmcd/2660070 to your computer and use it in GitHub Desktop.
Save jmcd/2660070 to your computer and use it in GitHub Desktop.
Adding paths to view engine without subclassing
var viewEngine = (RazorViewEngine)ViewEngines.Engines.Single(ve => ve is RazorViewEngine);
viewEngine.PartialViewLocationFormats = new List<string>(viewEngine.PartialViewLocationFormats)
{
"~/Views/Shared/Fields/{0}.cshtml",
"~/Views/Shared/ReadOnlyModels/{0}.cshtml",
}.ToArray();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment