This Example App contains implementation examples for various patterns and practices that I use on a daily basis. I use this app to try out changes and explore methods of making my code more cohesive.


I am using the new features in Visual Studio 2012. MSTest, Fakes, Test On Build.

Domain Driven Design

* The domain objects should encapsulate behaviour
* It should be easy to change the name of a domain object to match the real language in use (Ubiquitous Language - Eric Evans)

Repository Pattern

Persistence will be handled by repositories. A repository is solely responsible for mapping the storage mechanism to the domain.

* It should be easy to make changes to the underlying storage mechanism, i.e. adding or renaming a column
* It should be reasonably simple to change the underlying storage mechanism itself, i.e. switch from vendor A to vendor B, or switch from ADO.NET to EntityFramework
* A database table should be owned by a single repository

Type Safe Enums

I am using the Type Safe Enum pattern to handle the management of enums that are persisted.

Extension Methods

I am using simple extension methods to make some operations more readable, i.e.


Rather than:


Code Contracts

Last edited Sep 26, 2012 at 1:17 PM by Sohnee, version 10