Repository

A Repository object implements the Repository Pattern and acts an abstraction layer between the Domain Model and the database.

By hiding the complexities of the database, the Repository object helps make the implementation more testable, while preventing persistence level information from accidentally slipping into other parts of the system.

Repositories can be {{alias: Collection-Oriented RepositoryCollection-Oriented}} or {{alias: Persistence-Oriented RepositoryPersistence-Oriented}}, depending on the implementation. Collection-oriented repositories behave as if data is always present in Memory as collections (lists or sets) automatically loading and persisting data. In contrast, persisted-oriented repositories require explicit saving of data to the database.