MonoRail (software)
MonoRail (formerly called Castle on Rails), a component of the Castle Project, is an open source web application framework built on top of the ASP.NET platform. Inspired by Ruby on Rails Action Pack,[2] MonoRail differs from standard ASP.NET Web Forms development by enforcing separation of concerns using a model–view–controller (MVC) architecture.[3] The framework is commonly used in conjunction with Castle ActiveRecord, an ORM layer built on NHibernate. In January 2010, version 2.0 of MonoRail was released, however, many projects use the trunk version of the source to take advantage of new features without waiting for official releases. Although the project's name is MonoRail, it does not have any affiliation with the Mono project. How it worksThe framework maps web requests to an "action", which is a regular .NET method on the controller. The controller is responsible for invoking business services and controlling the application's flow. When it is time to send the web response to the client, the controller sets a view template to be rendered, putting data in a special dictionary object known as the "Property Bag", and delegates the template rendering to a view engine.[4] The view engine renders the template into the response stream utilizing the data in the property bag given by the controller. At this stage the view cannot access any other layer of the application, isolating the view from the application logic. View enginesThe mainstream view engine used in MonoRail is NVelocity, based on the Apache Velocity library. NVelocity is supplied with simple control blocks such as if statements and foreach loops. The NVelocity view templates are text files with the extension '.vm'. Other view engines in use:
Other view enginesBuilding other view engines is quite simple and straightforward. Brail, StringTemplate and AspView were all created by independent developers to suit their own needs. Other view engine are:
ReferencesFurther reading
External linksResourcesBlogs on MonoRail
|