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,131 | Comments: 45,568

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.


  1. RavenDB Conference 2016–Slides - 4 hours from now
  2. Proposed solution to the low level interview question - about one day from now

There are posts all the way to Jun 02, 2016


  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series



Main feed Feed Stats
Comments feed   Comments Feed Stats