Best practice DDD/TDD ASP.NET MVC example applications

It’s no secret that I’m a big fan of the ASP.NET MVC Framework. One of the reasons I like it is because it’s opinionated – instead of leaving developers free to fumble things as they choose, it recognises that most projects will be more-or-less exactly the same, and imposes some conventions to keep everyone on the same path.

This is the same philosophy used by many other application frameworks, and it saves everyone time and confusion by providing well-thought-out standards that everyone’s familiar with. However, because ASP.NET MVC is a general purpose web framework, its conventions can only cover so much — guidance for other frameworks and patterns is left to the community.

One very important area (that inspired this article) is around object-relational mappers (ORM). If I’m using the ASP.NET MVC framework:

  • How do I reference a repository from controller?
  • What’s the best way of applying a per-http-request unit of work pattern?
  • What should it look like if I’m using NHibernate? LINQ-to-SQL? etc.

Thankfully, there are a few example applications available that demonstrate solutions to these questions (and many more):

Kym NHibernate, Rhino-Commons, Castle Windsor, NUnit, Rhino Mocks, jQuery, Json.NET
S#arp Architecture NHibernate, Ninject, MvcContrib, NUnit, Rhino Mocks, Json.NET
CarTrackr Linq to SQL, Unity, MSTest, Moq, Visifire Silverlight charts, OpenID
MVC Storefront LINQ to SQL, StructureMap, MSTest, Moq, NLog, CardSpace, Windows Workflow, OpenID
Suteki Shop LINQ to SQL, Castle Windsor, NUnit, Moq, log4net, jQuery

It’s really good to see some different opinions in implementation and design, across a range of frameworks. MVC Storefront is of particular note – everything is explained over a series of 20-or-so podcasts that include interviews with well-known .NET developers like Jeff Atwood (Coding Horror/StackOverflow), and Ayende (NHibernate).

November 2, 2008

6 Comments

Dragan Panjkov on December 16, 2008 at 7:59 pm.

Take a look at Suteki Shop – by Mike Hadlow http://code.google.com/p/sutekishop/

Richard on December 17, 2008 at 8:13 am.

Thanks Dragan, I’ve added it to the list :)

Ta4ka on December 27, 2008 at 3:27 am.

Awesome list thx, also i noticed kigg is missing. http://www.codeplex.com/Kigg/Release/ProjectReleases.aspx?ReleaseId=10931

matt kocaj on November 25, 2010 at 11:34 pm.

Great list. MVC Storefront is bread and butter. Good to see it in there.

HuntSoul on August 4, 2011 at 2:06 pm.

Hi,Richard!I’m your big firend!I’m very like to read your articles,which give me new thought,and I’d like to read somethind about Unit Of Work Pattern that wrote by you!I hope you can share this for me!Thank you what you are sharing to we!

Matt on September 11, 2012 at 9:31 pm.

Thank you for sharing your list. What i was looking for is DDD example. Do you know a good documented open source project to study DDD?

Leave a Reply