На самом деле вам не нужно реализовывать новый движок для изменения путей, вы можете просто зарегистрировать их по своему желанию:
private static void RegisterViewEngines(ICollection<IViewEngine> engines)
{
engines.Clear();
engines.Add(new RazorViewEngine
{
MasterLocationFormats = new[] { "~/Themes/My/master.cshtml" },
ViewLocationFormats = new[] { "~/Modules/{1}/{0}.cshtml" },
PartialViewLocationFormats = new[] { "~/Blocks/{0}.cshtml" },
});
}
protected void Application_Start()
{
RegisterViewEngines(ViewEngines.Engines);
}
Для справки пути по умолчанию следующие (не включая районы):
ViewLocationFormats = new [] {
"~/Views/{1}/{0}.cshtml",
"~/Views/{1}/{0}.vbhtml",
"~/Views/Shared/{0}.cshtml",
"~/Views/Shared/{0}.vbhtml"
};
MasterLocationFormats = new [] {
"~/Views/{1}/{0}.cshtml",
"~/Views/{1}/{0}.vbhtml",
"~/Views/Shared/{0}.cshtml",
"~/Views/Shared/{0}.vbhtml"
};
PartialViewLocationFormats = new [] {
"~/Views/{1}/{0}.cshtml",
"~/Views/{1}/{0}.vbhtml",
"~/Views/Shared/{0}.cshtml",
"~/Views/Shared/{0}.vbhtml"
};