Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,026 | Comments: 44,842

filter by tags archive

MonoRail With SubSonic

time to read 4 min | 601 words

In the Castle forums, it was asked if it is possible to use SubSonic as the DAL for a MonoRail application. The answer is absolutely yes.

You will usually see MonoRail samples with either Active Record or NHibernate, simply beacuse this is what most of the users of MonoRail are using, but MonoRail has no data access preference. (There are extention to MonoRail that make it work better with Active Record and NHibernate, but those are just that, extentions, the core is completely data layer agnostic).

So, how would you go about using SubSonic with MonoRail?

Here is the controller:

public class ProductsController
 public void List()
  ProductCollection products = new ProductCollection();
  PropertyBag["products] = products;

And here is the view:


<% for product in products: %>

<li> ${product.Name} </li>

<% end %>



Steve Harman


I've been saying (for far too long now) that I really want to get down-and-dirty with both SubSonic and MonoRail - and now it sounds like I can get neck deep in both at the same time!


I've been using MonoRail with Paul Wilson's O/R mapper (www.ormapper.net) -- most recently using my own wrapper (http://www.hosted-projects.com/trac/computersims/wilsonorwrapper) -- since day 1, and have had no issues. MonoRail works very nicely with other DALs.

The nice thing is if you do a little planning, you can make your views DAL-agnostic. For example, in your above example, if you switched to another DAL but kept the same entity/property names, your view code could be exactly the same.

Paulo Quicoli

Hi Ayende !

I was looking for some kind of MVC for my application ( windows forms ), and found this project : www.codeplex.com/nmvp

Its a MVP implementation, works for asp.net and windows forms... take a look...

Christopher Bennage

I was able to integrate our home grown O/RM into MonoRail in about 30 minutes and with less than 100 lines of code. (By integrate, I mean having controller methods receive arguments reconstituted through our O/RM.) I created a sub class of DataBinder, DataBindAttribute, and SmartDispatcherController


yes its possible to have MR work for any DAL, but before you try to use that with SubSonic, I still recommend you try ActiveRecord. I don't see a point to give up AR and use SubSonic DAL, I have tried both and applied on 1 CSK 2.0 project- believe me you don't want any DAL when u see how well AR works.

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Technical observations from my wife (3):
    13 Nov 2015 - Production issues
  2. Production postmortem (13):
    13 Nov 2015 - The case of the “it is slow on that machine (only)”
  3. Speaking (5):
    09 Nov 2015 - Community talk in Kiev, Ukraine–What does it take to be a good developer
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats