Sustainable Waste Solutions (SWS) required a database and admin to manage their clients and prospects for outreach.

I had to design the database based around initial requirements that changed over development.


I decided to create multiple layers to separate the concerns and role each layer needed to be responsible for:

  • Website
  • Service
  • Data
  • Domain
  • Exceptions

Data access

I decided to use the repository pattern in my data access layer because of its simple role to accept and pass back data and it’s interface implementation design.

I relied on the ORM PetaPoco by Topten Software because of its simple integration and because it just works with your database.

However I found that two features I was looking for: concurrency and mapping wasn’t part of PetaPoco. I found blog post on who had forked PetaPoco and added the features I wanted.

Because I was separating my code into layers I didn’t want to tie my models to the my data access layer by adding PetaPoco attributes.

With mappings I was able to let PetaPoco know how to map objects to tables without adding attributes to my models.


The way SWS would manage their contacts would be through a website.

I used ASP.NET MVC3 with the goal to keep the controllers skinny and rely on the service layer to communicate with the data layer.

The website also handles displaying errors that might come up, including:

  • Not found objects
  • Issues with concurrency
  • Attempting to delete entities that are used as a primary key

I also followed the convention of not passing models to the view and instead relied on viewmodels, using AutoMapper to do the mapping.

The admin also allowed individual and lists of contacts to be exported for various lists to Excel documents with the Open XML SDK.

Some of the exported Excel files also generate separate workbooks to help display the one-to-many relationships a entity object might have.

During development I used ELMAH to log errors.

Additionally there was a need to let people sign up for mailings and newsletters so a intermediate table and admin was created to store and manage these registrations before inserting them in with the rest of the contacts.

Most of the third-party libraries were brought in with the Nuget package manager.

Overall the project was a good experience for developing a multi-layered application that served a specific role and that provided business value to a client.