Hi Group,
I recently wrote some extension methods to simplify the programmatic
configuration of Monorail. For example instead of
var viewEngineConfig = configuration.ViewEngineConfig;
viewEngineConfig.VirtualPathRoot =
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "views");
viewEngineConfig.ViewEngines.Add(new
ViewEngineInfo(typeof(AspViewEngine), true));
viewEngineConfig.ViewEngines.Add(new
ViewEngineInfo(typeof(NVelocityViewEngine), false));
I now simply write:
configuration.ViewEngineConfig
.SetRelativeViewDirectory("views")
.AddViewEngine<AspViewEngine>(true)
.AddViewEngine<NVelocityViewEngine>(false);
Another example: to use the smtp settings from the web config
<smtp> section I can write:
configuration.SmtpConfig.ConfigureFromWebConfig();
(I could not find an existing facility in MR for this)
These extension methods could be easily added as normal instance
methods of ViewEngineConfig and SmtpConfig. If anyone is interested, I
can submit a patch. I don't even know whether there are that many
"programmatic configurers".
Regards,
Andre