【翻译】 MonoRail 是如何工作的?( MonoRail:How it works)
Posted on 2006-09-22 10:04 joyyuan97 阅读(424) 评论(0) 编辑 收藏 举报原始链接:http://www.castleproject.org/index.php/MonoRail:How_it_works
The following picture depicts the overall flow of each request being served by MonoRail.
下面的图形描述了MonoRail如何为每个请求提供服务的全过程。
The RailsHttpHandler is an ASP.Net IHttpHandler that tokenizes the Url and instantiates the Controller. From this point, it's up to the Controller itself to invoke the action. The view engine instance is passed to the controller, so it can invoke the IViewEngine.Process so the content can be rendered.
RailsHttpHandler是一个Asp .Net IHttpHandler的实现类,它实现对URL的解析并创建控制器对象(译者注:Castle Rails引擎会解析URL,从中分解出控制器名称和动作名称。实例化控制器对象并调用指定的动作)。在此处,通过控制器本身实现动作的调用。视图引擎实例已被传给控制器,故控制器可已调用IViewEngine(视图引擎接口),处理器可以生成相应的内容并返回给Castle Rails引擎。
Please note that the rendering of the view happens after the action method returns, the RenderView method just indicates which view you want it to render.
请注意视图渲染动作是在控制器的Action动作执行完毕返回后才被调用。RenderView函数用来指明哪一个视图是你想调用并渲染的。