Hire me at Go Tripod.

My Solution Template

January 27th 2008, 1:53 am in Development, Visual Studio.

For a while I’ve been meaning to come up with a repeatable starting point for my projects. Not only is adding references, configuration and structure to a solution labourious, it’s also pretty difficult to remember every step. Ideally, I wanted to be able to start a project with everything ready for me.

I spent a while today doing just that; a solution which matches the starting point for most of my projects. Firstly, there’s a Monorail project with Windsor, NHibernate and logging integration switched on. All of the required DLL’s have been moved into a Libs directory in the solution folder – the idea behind that is to allow a developer to be able to build the project without needing to install Monorail or any other components. Secondly, there’s a unit tests project with a couple of folders; Controllers and Persistance. These suggest a future structure for this project, with Persistance being used to check the NH mappings work as expected. In addition it contains an NHTestBase class which allows my unit tests to run with a SqlCe database. Thirdly, a project called Core; this holds core functionality for the solution, such as entities and services, exceptions and utility methods.

The whole thing can be found here: http://dev.plastiscenic.co.uk/svn/projects/Plastiscenic.Sample/ but it’s missing one thing – a good way to customise it. Namespaces, directory names, etc, need to be manually changed. For me that’s still better than building it up from scratch but it’s still a pain. If anyone’s got any suggestions, I’d love to hear them.

One final note; this has pushed me to collect together a couple of classes I use often, and I’ve stolen Ayende’s naming convention by creating Plastiscenic Commons. This contains a repository implementation, stuff for setting up a SqlCe database, a static container accessor, and a few other bits. Nothing exciting but I always need them.

Feedback appreciated.

Responses to “My Solution Template”

Comments are closed.

  1. thanks for providing your sample solution – it’s really interesting to see how other people handle their projects… I have just few quick notes from my first look at your solution:
    - why don’t you use NH2 instead of 1.2.0.4?
    - why do you prefer to map your controllers manually in controllers.config instead of mapping whole *.web assembly?
    - is your IRepository sufficient for you? I find it quite minimalistic – I prefer to have a richer set of methods eg. for SlicedFind etc… also I find it quite nice to implement validation in the Save() method, but this is another chapter I guess..

    //please note that I’m not much experienced Castle user, so my thoughts may be sometimes pointless :)

    Filip Kinsky
  2. AFAIK NH2 isn’t stable yet, and I’ve not had any real need to upgrade. Also, I RC3 of Castle uses NH 1.2.

    I don’t have many controllers so it’s not a big deal but the truth is I’ve never tried to map the entire assembly.

    The projects I’ve been using the IRepo on are pretty basic and therefore so is the interface. I can certainly see lots of changes that can be made but I’m not one for adding stuff I’m not going to use right now.

    Colin Ramsay