Last active
August 29, 2015 14:03
-
-
Save cwe1ss/970c65995280496a1864 to your computer and use it in GitHub Desktop.
Custom ViewEngine for the "Feature Folder" project structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FeatureFolderViewEngine : RazorViewEngine | |
{ | |
public FeatureFolderViewEngine() | |
{ | |
// {0} ActionName | |
// {1} ControllerName | |
// {2} AreaName | |
AreaViewLocationFormats = new[] | |
{ | |
"~/Areas/{2}/{1}/{0}.cshtml", | |
"~/Areas/{2}/Shared/{0}.cshtml", | |
"~/Areas/Shared/{0}.cshtml", | |
}; | |
AreaMasterLocationFormats = new[] | |
{ | |
"~/Areas/{2}/{1}/{0}.cshtml", | |
"~/Areas/{2}/Shared/{0}.cshtml", | |
"~/Areas/Shared/{0}.cshtml", | |
}; | |
AreaPartialViewLocationFormats = new[] | |
{ | |
"~/Areas/{2}/{1}/{0}.cshtml", | |
"~/Areas/{2}/Shared/{0}.cshtml", | |
"~/Areas/Shared/{0}.cshtml", | |
}; | |
ViewLocationFormats = new[] | |
{ | |
"~/Features/{1}/{0}.cshtml", | |
"~/Features/Shared/{0}.cshtml", | |
}; | |
MasterLocationFormats = new[] | |
{ | |
"~/Features/{1}/{0}.cshtml", | |
"~/Features/Shared/{0}.cshtml", | |
}; | |
PartialViewLocationFormats = new[] | |
{ | |
"~/Features/{1}/{0}.cshtml", | |
"~/Features/Shared/{0}.cshtml", | |
}; | |
FileExtensions = new[] | |
{ | |
"cshtml", | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment