如果我理解了此权利。.剃须刀视图引擎被指定仅允许默认路径的htmlhelper Editables ..但是,如果我更改或扩展引擎应何处的路径寻找我的部分视图,然后希望能够在其中一个部分中使用html.editorfor()...无论如何是否有可以让html.editor.也可以使用此自定义路径?
<</p>是的您正在寻找。如果您想查看如何使用新路径创建自己的视图引擎的示例,请从我的一个项目中查看此视图引擎。
https://github.com/stevehodgkiss/restful-routing/blob/master/src/restfulrouting/viewengines/restfulroutroutroutroutingrazorviewengine.cs
public class RestfulRoutingRazorViewEngine : RazorViewEngine
{
public RestfulRoutingRazorViewEngine()
{
AreaMasterLocationFormats = new[] {
"~/Views/{2}/{1}/{0}.cshtml",
"~/Views/{2}/{1}/{0}.vbhtml",
"~/Views/{2}/Shared/{0}.vbhtml",
"~/Views/{2}/Shared/{0}.cshtml",
};
AreaViewLocationFormats = new[] {
"~/Views/{2}/{1}/{0}.cshtml",
"~/Views/{2}/{1}/{0}.vbhtml",
"~/Views/{2}/Shared/{0}.cshtml",
"~/Views/{2}/Shared/{0}.vbhtml",
};
AreaPartialViewLocationFormats = AreaViewLocationFormats;
}
}
我仍然使用编辑来找出我的编辑和显示模板的视图。