When I build repositories in my domain, I often find my find myself in a dilemma. Should I create generic, boilerplate code for reuse, or should I be explicit? How should I design my repositories in a way that it is as technology agnostic as possible? I don’t want to care about DAL while I am designing my repositories.
There is no “One” design; every project is different. It is silly to even dream up one… I will create series of posts which will be an exercise to compare and discuss each implementation.
Objective
Build a service layer and repository implementations to service Customer entities in a console application. The application uses DDD (Domain Driven Design) in its architecture.
Solution
I will use different ORMs and patterns to implement the repository pattern. I will do this iteratively and improve implementation as I go. I’ll try to use various ORMs (Linq to Sql, EF, NHibernate), persistence stores (MongoDB, SQL Server), design patterns and techniques (Specification, Services, IoC) along the way.
Let’s see where we’ll end up…
Resources
- Martin Fowler – PoEAA – Repository
- DDD – Domain Driven Design
- NHibernate
- EF (Entity Framework)
- Linq To SQL
- Specification Pattern
- IoC (Inversion of Control)
- Service Layer
- MongoDB
1 Comment