in .NET, Rails

Looking for ASP.NET MVC Frameworks…

I have been looking for an open source alternative to the default way of buildig web sites in ASP.NET with Visual Studio. After having build a couple of applications with Ruby on Rails it hard to go back to the Page Controller pattern that Microsoft introduced in ASP.NET. Coming back to the ASP.NET page event model makes it clear that they created it for VB6 application developers that were used to Windows forms-centered development. Apparently they didn’t want to those developers to have to learn about HTTP and HTML to be able to write applications.

I guess from a marketing persepective it may have been the right choice (for Microsoft), but right now it feels like a horrible mess for me. So, I spent a couple of hours researching the alternatives. There are a number of commercial packages available (LLBLGen et al) but I only found three that looked interesting for my purposes:

  1. MonoRail: The Ruby on Rails-inspired framework with an ActiveRecord component based on NHibernate.
  2. Spring.NET: A port of the Spring framework for Java.
  3. PixelDragons MVC: this looks promising but seems to lack real world use? Requires further investigation.

Looking at the quickstart documentation for Spring.NET I decided that it was way too much configuration involved to get things running. Ruby on Rails has definitely lowered my tolerance for lengthy project setups.

The getting started tutorial for MonoRail looked much more pleasant. The MonoRail framework comes with a nice MSI installer and a custom project wizard to quickly set up a project skeleton in Visual Studio 2005. There is even an option to create an associated test project from the start.

After some initial problems with getting the application talking to my SQL Server 2005 database (Microsoft has drastically increased security for the 2005 version resulting in a number of configuration steps to be able to talk to the db at all) I had a sample app going. Users of Ruby on Rails will feel at home since you can do nice stuff like:

public void CreateUser()
{
      User owner = new User();
      owner.FirstName = "Peter";
      owner.LastName = "Krantz";
      owner.Create();
}

Then I wanted to try a TDD approach and this is where I am currently stuck. The MonoRail project wizard creates a sample test project with a sample test of a controller. However, according to people in the forum that approach is deprecated and a different way of testing controllers is described on the MonoRail wiki. But that approach does not work for testing your model classes and there is no information on how to get an application context to do that. Or maybe I have missed it when Googling for a solution.

Can I have just the O/RM please?

So, if I go back to the Page Controller pattern, can I please have an open source persistence framework that allows me to write code like above? I was happy to find this rather extensive list of persistence frameworks. The only problem is that most of them are not actively developed anymore. Or, they have simply disappeared as Microsoft is shutting down the GotDotNet website where many of them are/were hosted.

If you stick to the default pattern in ASP.NET you have a wealth of excellent tutorials and documentation from Microsoft and others. Going off the beaten track seems more difficult though. Hopefully the MonoRail issue will be solved and I can use it for my product idea.

Write a Comment here on the real web

Comment

13 Comments

  1. Monorail (along with the rest of the castle stack) is the only framework worth looking into right now. As for persistence, look at NHibernate alongside ActiveRecord.
    Take a look at Ayende’s site for some monorail screencasts and other useful monorail stuff.

  2. Monorail is really your only choice. But I have heard through the grapevine that Microsoft is working on producing a MVP/MVC framework for ASP.NET since the ROR framework is becoming popular. I heard this from a MS employee… so there could very well be some truth in this matter. Issues are IIS 6.0 which IIS 7.0 should take care of. I was told to keep an eye out in Oct/Nov for the release of a MS MVP/MVC pattern. Enterprise Pattern?

  3. I haven’t seen that one yet. But out of the ones that had been listed in the blog posting, monorail I have found to be the least headache to enabled. I will at a look at this framework. Do you use currently? With success?

  4. I just read somewhere in blogs recently that Microsoft is almost ready with MVC framework and are about to announce somewhere in October.

    Can any one confirm this again.

    Microsoft has been quiet a lot about MVC framework and VBx ( The Dynamic Language ).

    IronRuby shall work on Net framework and shall fully support Ruby on Rails…. My question is which MVC pattern are they going to use.

    Mr. Scott Guthrie in one of his blogs comments said that MVC for asp.net will be independent of language.

    Hoping to get some fresh news about this.

  5. Fredrik,
    I have talked to a few MS employees who have confirmed the MVC framework for ASP.NET, but no real details. Said to look for beta in November.

  6. This looks very interesting. Hopefully Microsoft will have had a look at what what developers are looking for in an MVC framework.

Webmentions

  • Microsoft to release MVC framework with Visual Studio 2008 - Peter Krantz February 1, 2009

    […] someone hinted in the comments to my previous posts on ASP.NET MVC frameworks, Microsoft is apparently releasing a new MVC framework to make ASP.NET development simpler. […]

  • dotnet on Rails - MonoRail « maonet technotes February 1, 2009

    […] Pro Spring, which covers DI (Dependency Injection)  and MVC on Java. I had the same feeling with peterkrantz,  yes, too much configuration works.  Rails is way better than that. How can Spring.net […]

  • When PHP makes sense - Peter Krantz February 1, 2009

    […] at creating the app in ASP.NET and make it run under Mono. Unfortunately I can’t find an MVC framework for ASP.NET that works the way I want. Ruby on Rails has really lowered the threshold of what I can put up with […]