views:

207

answers:

2

This is more of an open question rather than looking for one specific answer.

As we all know there is no one answer that fits all solutions but I am curious to find out how you structure you asp.net MVC solutions and any pitfalls you may have come across in your design or things that you would do differently if you could start again.

The standard asp.net MVC template is just a basic template and I'm sure I've read/heard in a podcast that Scott Hanselman stated the only reason the Model folder is there is so people didn't ask where's the model. This already implies that maybe it should be moved to its own separate class.

Personally in the small MVC apps I've done I've separated out the model into its only class that holds the model and the repository while the 'MVC' project has the controller and the views. This has generally workout without any issues but as I said these have only been small apps.

So what are most people doing? - Just using the standard template? - Separating out just the model? - Separating out the model and the controller? - Separating out even move so all the data access is done through web services or some sort of data portal? - Or something totally different?

Finally how are people creating unit tests? Just one unit test class that test each of the projects or a unit test class for each project?

+2  A: 

Personally I use Jimmy Bogard's approach: Organizing ASP.NET MVC solutions.

mrydengren
Interesting approach, after a couple of MVC projects on a much larger scale the default layout starts to look cluttered indeed.
Martijn Laarman
A: 

To be honest, most of the time I have found the standard template tidy enough for me to simply re-use it. I would say its really just down to your own particular organizing preferences.

If my model got really large I would definitely consider creating a separate class library project for it.

James