Sunday, September 14, 2014

Repository Pattern

There are patterns considered as Domain Driven Design patterns. This post introduces Repository pattern.

Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects (martin fowler).

  • 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.

  • DDD repository is limited to aggregate roots only
  • Hides  persistence storage  features behind a repository interface which sometimes is limiting

Sample Code


No comments :

Post a Comment