Repository Pattern
Definition
Applicability
Downsides
Sample Code
http://ayende.com/blog/3955/repository-is-the-new-singleton
Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects (martin fowler).
Applicability
- When you want to isolate domain objects from details of database access code.
- Acting like an in-memory domain object collection
- Providing a more object-oriented view of the persistence layer
- A clean separation and one-way dependency between the domain and data mapping layers.
Downsides
- DDD repository is limited to aggregate roots only
- Hides persistence storage features behind a repository interface which sometimes is limiting
Sample Code
References
http://martinfowler.com/eaaCatalog/repository.htmlhttp://ayende.com/blog/3955/repository-is-the-new-singleton
Comments