Repositories

Learn how to isolate business logic from data-access logic, through the implementation of a repository pattern in the DDD world.

Sometimes, it is necessary to interact with any type of persistence system in an application. Such a persistence system may be a SQL or NoSQL database, a file, or even an external service. There should be a mechanism that allows us to interact with these systems. The important point here is that the business logic remains separate from the repository-connections logic.

What are repositories?

A repository does not necessarily involve a database. A repository is a pattern, which isolates business logic from data-store-interaction logic. It functions as a collection of objects in memory. It conceals the storage-level details needed for management and query of the information of an aggregate in the underlying data tier. When an aggregate wants to interact with information outside of ...