是否有可能在青山单轨使用System.Web.Routing? [英] Is it possible to use System.Web.Routing in Castle Monorail?
问题描述
是否可以使用Microsoft(或单声道)提供建设城堡单轨应用为ASP.NET时System.Web.Routing代替单轨路由东西?关于如何实现这是一个解决方案,有什么好消息?利弊?
Is it possible to use the Microsoft (or Mono) supplied System.Web.Routing instead of the MonoRail routing stuff when building a Castle MonoRail app for ASP.NET? Any good information on how to implement this as a solution? Pros and cons?
推荐答案
这是完全可能的。您应该实现ASP.NET的 IRouteHandler
,将查找路由数据在给定的 RequestContext的
,然后用手数据到单轨。
It is quite possible. You should implement ASP.NET's IRouteHandler
that will look up the route data in the given RequestContext
, and then hand the data over to MonoRail.
这是可以做到的几种方法。我想这Server.RewritePath会的工作,但你可以更清晰地查找在两个班单轨铁路的code即 MonorailHttpHandlerFactory
和 RoutingModuleEx
,弄清楚如何返回设置所需要的东西放在 MonoRailHttpHandler
你会从 IRouteHandler $ C返回$ C>。
That can be done is several ways. I guess that Server.RewritePath will work, but you can more cleanly lookup the code in two classes of MonoRail, namely MonorailHttpHandlerFactory
and RoutingModuleEx
, to figure out how to return set the needed things on the MonoRailHttpHandler
you'll return from the IRouteHandler
.
至于问题 - 这将是非常棘手的反向,即生成控制器动作路线。
As for problems - it would be very tricky to to the reverse, i.e. generate routes from controller actions.
这篇关于是否有可能在青山单轨使用System.Web.Routing?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!