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 %>