Repository

Pattern: Repository

A Repository object acts as a collection of Aggregate Objects in memory. It hides the storage level details needed for managing & querying the state of the Aggregate in the underlying data tier.

Realizes the Create | Retrieve | Update | Delete operations on the aggregate objects.

  • Created on per Aggregate basis
  • May expose higher level behavior | functions e.g., get all inactive account aggregate objects
  • Persistence operations are Atomic e.g., transaction added to account and balance update
  • Managed as part of the domain layer
  • Hides the underlying storage tier; data tier change have no impact on the clients of Aggregate e.g., switching of database from Oracle to MongoDB will require no change in the rest of the model