Repository

Database

Definition
The repository pattern contains a central data repository, and a number of clients that modify this repository.

Note: there's also a software design pattern by the same name, but with different meaning for example

The repository pattern is commonly implemented as a database management system (DBMS). The DBMS can provide a domain specific language, ACID, transactions, backup and restore, access management, and much more.

Repository architecture diagram

When should you use it?

Use it when the data of your application is a goal in itself, or when its too costly to transfer the data all the time.

Problems

  • Since all clients of the repository may be active at the same time, the repository needs to implement locking mechanisms to ensure the integrity is kept intact.

Links