Monday, June 28, 2010

Rails3 vs. ASP.NET MVC

This article by Anders Janmyr shines the light on the differences between these frameworks.

Whether your going from Rails to ASP.NET MVC or vice-versa - a quick read through this article will save you many hours of hitting your head against the keyboard.

Friday, June 25, 2010

Lazy Load This!

Or rather - "Lazy Loading can cause problems with C# code"

Here was my dilemma:

class Foo
public virtual Bar bar {get; set;}

Had the Fluent NHibernate ClassMap:

class FooMap : ClassMap<foo>
References(x =>;

No problem right? Well it was working fine until I tried to serialize the result using MVC Contrib's XmlResult object. Kaboom! It took me many hours to figure out that the serializer was trying to use the proxy class to Bar instead of Bar itself.

The solution was to modify the FooMap to not lazy load like this:

class FooMap : ClassMap<foo>
References(x =>;

This could probably lead to performance problems in production - so if you do turn off the default lazy loading behavior, ensure you're using a product like NHProf or a SQL Profiler to monitor what your ORM is doing.

Wednesday, June 23, 2010

Test-Drive ASP.NET MVC = Released!

After over 15 months of work, my book is now officially available directly from the publisher here. I love the cover - wish one of these came with every book**:

I'd like to thank Dave and Andy, as well as my editor Susannah Davidson Pfalzer for helping me through the entire process.

I expect in the next few weeks the book will be available through other channels like Amazon, Barnes&Nobles, etc. However, the only way to get an e-book version is directly from the Pragmatic Bookshelf

**no cars are included with the purchase of the book ;)

Wednesday, June 2, 2010

Interview with Phil Haack - Project Manager of ASP.NET MVC

PragPub magazine, the Pragmatic Bookshelf's monthly publication, has a couple of articles on ASP.NET MVC this month. The first is an article by yours truly on introducing the framework to a non-Microsoft audience. I'd be interested in your feedback on how I fared - especially from seasoned Rails developers.

The second article is an interview with Phil Haack himself. I found Phil's narrative on how ASP .NET MVC has been received by the Rails community very interesting.

Best part of the whole June edition is the Chinese dragon on the front.

To view the magazine in PDF click here. If you like it you can sign up for a free monthly subscription here.