Extensions
From MonoRail beta 5 you can use the new Extensions support which allow you to plug existing extensions or develop your own extensions. This document should clarify why extensions were introduced, a list of out-of-box extensions and how to create your own extensions.
Rationale
The user and development community on MonoRail is quite active, and consequently we receive lots of suggestion about new interesting features. Some of the features are unarguably helpful for the almost every user, however most of them are only useful to some specific users/scenarios. So implementing the new feature directly into the core framework would not make much sense as they usually increase the request flow overhead and the users that are not using the feature would be penalized.
Extensions were introduced to allow the framework to be extended easily and extensions to be reused.
Existing Extensions
With the beta 5 version we shipped two extensions. As they can be helpful for some scenarios, they were also developed to serve as sample extensions, so the code is very simple.
Custom Session
Allow you to provide a custom session. The custom session will be available in IRailsEngineContext property Session.
Read more on Custom Session Extension.
Exception Chaining
Intercepts all exception during action processing and run a chain of exception handlers to do whatever they want with the exception (logging to a file, database, send through e-mail, etc)
Read more on Exception Chaining Extension.
Creating your own extension
Creating an extension is a fairly simple task. Just create a new public class and implement the IMonoRailExtension or extend from AbstractMonoRailExtension. The latter is simpler.
After that you can override the methods you want. Usually your extension will read some custom configuration from the MonoRailConfiguration to configure itself if necessary and then perform some action when one of the hook methods is invoked.
MonoRail must be told that an extension exists. You can do that by using the extensions node in the configuration file. For more on that, check the MonoRail Configuration Reference document.