[csharp]
public class StructRazorViewEngine : RazorViewEngine
{
public StructRazorViewEngine()
: base()
{
//Area视图路径其中{}{}{}分别代表Area名Controller名Action名
AreaViewLocationFormats = new[] { ~/{}/{}/{}cshtml ~/Shared/{}cshtml };
//Area模版路径
AreaMasterLocationFormats = new[] { ~/Shared/{}cshtml };
//Area的分部视图路径
AreaPartialViewLocationFormats = new[] { ~/{}/{}/{}cshtml ~/Shared/{}cshtml };
//主视图路径
ViewLocationFormats = new[] { ~/{}/{}cshtml ~/Shared/{}cshtml };
//主模版路径
MasterLocationFormats = new[] { ~/Shared/{}cshtml };
//主分部视图路径
PartialViewLocationFormats = new[] { ~/{}/{}cshtml ~/Shared/{}cshtml };
}
protected override IView CreatePartialView(ControllerContext controllerContext string partialPath)
{
return baseCreatePartialView(controllerContext partialPath)
}
protected override IView CreateView(ControllerContext controllerContext string viewPath string masterPath)
{
return baseCreateView(controllerContext viewPath masterPath)
}
protected override bool FileExists(ControllerContext controllerContext string virtualPath)
{
return baseFileExists(controllerContext virtualPath)
}
}