MonoRail (software)

Castle Project:MonoRailDeveloper(s)| Castle Project

|

Stable release|

2.1 RC[1] / March 17, 2011 (2011-03-17)

Operating system| Cross-platform
Type| Application framework
License| Apache 2.0
Website| www.castleproject.org/projects/monorail

* Free and open-source software portal

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 works

[edit]

The 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.

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 engines

[edit]

The 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:

* Brail, based on the Boo language. Being a .NET language, the Brail view engine has stronger capabilities, as the view programmer can use the Base Class Library methods. However, power comes with its price, as it opens the possibility to do too much in the view, leaving some responsibility for Separation of concerns in the hands of the programmer. The view templates are text files with the extension '.brail'.
* AspView, a view engine that uses C# as its scripting language, and uses a pre-compiled approach, where all the views are pre-compiled to a .NET Assembly prior to deployment. The view templates are text files with the extension '.aspx'.
* WebForms ViewEngine lets you use some of the power of Web Forms in your MonoRail applications. The use of the WebForms view engine is quite sparse, and is only recommended for a migration phase from an existing Web Forms application to a MonoRail application. The view templates are text files with the extension '.aspx'.
* StringTemplate is the most strict view engine in terms of MVC.[4]
* Spark View Engine is a new view engine popular among ASP.NET MVC developers, supports MonoRail as well.

## Other view engines

[edit]

Building 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:

1. ASPX
2. Spark
3. NHaml
4. NDjango
5. Hasic
6. Brail
7. Bellevue
8. SharpTiles
9. String Template
10. Wing Beats
11. SharpDOM
12. Razor
13. Azure

## References

[edit]

1. ^ "Download | Castle Project".
2. ^ Ruby on Rails Action Pack
3. ^ "InfoQ: Catching up with the Castle Project". Retrieved 13 September 2007.
4. ^ Parr, Terence. Enforcing Strict Model-View Separation in Template Engines

## Further reading

[edit]

* James Avery, Jim Holmes, Windows developer power tools, O'Reilly Media, 2006, ISBN 0-596-52754-3, pp. 963-972 (18.6 Simplifying Web Development with Castle MonoRail)
* Steven Sanderson, Pro ASP.NET MVC Framework, Apress, 2009, ISBN 1-4302-1007-9, p. 12 (Comparisons with MonoRail)

## External links

[edit]

### Resources

[edit]

* MonoRail Documentation
* Presentation on MonoRail

### Blogs on MonoRail

[edit]

* Hamilton Verissimo's Blog, the founder of the Castle Project
* Ayende Rahien's Blog (Oren Eini), the creator of the Brail view engine
* Eleutian's Blog
* .net and other musings
* Ken Egozi's Blog, the creator of the AspView ViewEngine
* Adam Esterline's Blog

* v
* t
* e

Web frameworks

* Comparison

.NET|

* ASP.NET
* Core
* AJAX
* Dynamic Data
* MVC
* Razor
* Web Forms
* Blazor
* DNN
* BFC
* MonoRail
* Umbraco
* WebSharper

C++|

* CppCMS
* Drogon
* Wt

ColdFusion|

* ColdBox Platform

Common Lisp|

* CL-HTTP

Haskell|

* Servant
* Snap
* Yesod

Java|

* AppFuse
* Grails
* GWT
* ICEfaces
* JHipster
* JWt
* Mojarra
* Play
* Remote Application Platform
* Seam
* Sling
* Spring
* Stripes
* Struts
* Tapestry
* Vaadin
* Vert.x
* Wicket
* WaveMaker
* ZK

JavaScript|

* Angular/AngularJS
* Backbone.js
* Closure
* Dojo Toolkit
* Ember.js
* Express.js
* Ext JS
* htmx
* jQuery
* Knockout.js
* Meteor
* MooTools
* Next.js
* Nuxt.js
* Node.js
* OpenUI5
* Prototype
* React
* Remix
* Sencha Touch
* SproutCore
* Svelte
* Vue.js

Perl|

* Catalyst
* Dancer
* Maypole
* Mojolicious
* WebGUI

PHP|

* CakePHP
* CodeIgniter
* Drupal
* eZ Publish
* Fat-Free
* Flow
* FuelPHP
* Grav
* Gyroscope
* Horde
* Joomla!
* Laminas
* Laravel
* li₃
* Midgard
* MODX
* Phalcon
* PHP-Fusion
* PHP-Nuke
* Pop PHP
* PRADO
* ProcessWire
* Qcodo
* Silverstripe
* Symfony
* TYPO3
* WordPress
* XOOPS
* Yii

Python|

* BlueBream
* CherryPy
* CubicWeb
* Django
* FastAPI
* Flask
* Grok
* Nevow
* Pyjs
* Pylons
* Pyramid
* Quixote
* TACTIC
* Tornado
* TurboGears
* web2py
* Zope 2
* more...

Ruby|

* Merb
* Padrino
* Ruby on Rails
* Sinatra

Rust|

* Rocket

Scala|

* Lift
* Play
* Scalatra

Smalltalk|

* AIDA/Web
* Seaside

Other languages|

* Application Express (PL/SQL)
* Grails (Groovy)
* OpenACS (Tcl)
* Phoenix (Elixir)
* Shiny (web framework) (R)
* SproutCore (JavaScript-Ruby)
* Yaws (Erlang)

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template