我创建了一些包含路由部分的自定义内容类型,以便我的内容管理员可以编辑物品的slu gs。我没有运气配置一条路线,使我自己的控制器可以为这些项目提供请求。果园cms路由问题
核心Routable模块中ItemController的路径路径的优先级为10.我试图制作一条使用IRouteConstraint的路由,类似于Blog模块如何实现我想要做的事情,具有较低的优先级但仍然没有运气。
如果我让我的网址以/结尾,那么我的自定义路由被激活,因为它与我的内容项目的路径不匹配。这不是一个理想的解决方案。我无法理解为什么它不会发现我的自定义路由,它属于可路由模块的路由。
任何帮助将不胜感激,非常感谢提前。
UPDATE:
这是我GetRoutes从我IRouteProvider实现方法:
public IEnumerable<RouteDescriptor> GetRoutes()
{
return new[] {
new RouteDescriptor
{
Priority = 0,
Route = new Route(
"Admin/Jugganort/{controller}/{action}/{id}",
new RouteValueDictionary {
{"area", "Jugganort"},
{"controller", "Area"},
{"action", "List"}
},
new RouteValueDictionary(),
new RouteValueDictionary {
{"area", "Jugganort"}
},
new MvcRouteHandler())
},
new RouteDescriptor
{
Priority = 9,
Route = new Route(
"{location}/{merchant}/{promotion}",
new RouteValueDictionary {
{"area", "Jugganort"},
{"controller", "Home"},
{"action", "Index"},
{"merchant", UrlParameter.Optional},
{"promotion", UrlParameter.Optional}
},
new RouteValueDictionary {
{ "location", _routeConstraint }
},
new RouteValueDictionary {
{"area", "Jugganort"}
},
new MvcRouteHandler())
}
};
}
_routeConstraint是一个简单的实现IRouteConstraint的,只是寻找的“新堡”在路线位置的硬编码值。
我对RoutePart的理解不正确吗?这些项目是否总是需要从Routable模块的ItemController中提供?我唯一的选择是交替渲染自定义形状吗?
果园论坛将成为我的下一个呼叫点。再次感谢您提供的任何帮助。
我可以帮你解决这个问题,但我需要更多的细节。你如何为每个内容项目提供slu,,路线,路径,标题属性? 如果你的问题最后只是关于“/”,我很抱歉,但我认为你将不得不处理它。无论如何,你真的应该考虑在他们(官方果园团队成员)真正活跃的官方果园论坛上提出你的问题:http://orchard.codeplex.com/discussions/ – Proviste
你可以发布你的RouteProvider.cs吗? – mdm
见上@mdm – Brendan