Ayende @ Rahien

Hi!
My name is Ayende Rahien
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

@

Posts: 5,947 | Comments: 44,543

filter by tags archive

MonoRail With SubSonic


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();
  products.Load(); 
  PropertyBag["products] = products;
 }
}

And here is the view:

<ul>

<% for product in products: %>

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

<% end %>

</ul>


Comments

Steve Harman

Nice!

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!

Brian

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

goodwill

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.

FUTURE POSTS

No future posts left, oh my!

RECENT SERIES

  1. RavenDB Sharding (3):
    22 May 2015 - Adding a new shard to an existing cluster, splitting the shard
  2. The RavenDB Comic Strip (2):
    20 May 2015 - Part II – a team in trouble!
  3. Challenge (45):
    28 Apr 2015 - What is the meaning of this change?
  4. Interview question (2):
    30 Mar 2015 - fix the index
  5. Excerpts from the RavenDB Performance team report (20):
    20 Feb 2015 - Optimizing Compare – The circle of life (a post-mortem)
View all series

RECENT COMMENTS

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats