Repository (design pattern)

from Wikipedia, the free encyclopedia

Repository is a design pattern from the field of software development . It serves as an interface between the domain layer and the data access layer . It is particularly useful in situations in which there are many different domain classes or many different accesses to the data access layer.

Conceptually, the repository encapsulates the objects persisted by the data access layer and the access to them - regardless of whether they are stored in a database or made available via a web service (or otherwise). Object-oriented access to the data access layer and thus a clear separation and specific dependency between the domain layer and the data access layer are achieved.

implementation

In relation to the domain layer, the repository behaves like a list of technical objects. Technical objects can be added or removed as with a list in memory, the repository takes care of the mapping and the calling of the corresponding operations of the data access layer. In addition, declarative search queries can be used in the data access layer via the repository. In these cases, the use of the repository design template helps to reduce the multiple implementation of the search logic that is otherwise necessary.

See also

  • Domain-Driven Design - Repositories are an important part of the domain model of Domain-Driven Design

literature

Web links

  • Edward Hieatt, Rob Mee: Repository. Martin Fowler, accessed on February 1, 2013 (English): "Repository mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects."
  • The Repository Pattern. msdn, accessed on February 1, 2013 (English): "Use a repository to separate the logic that retrieves the data and maps it to the entity model from the business logic that acts on the model. The business logic should be agnostic to the type of data that comprises the data source layer. For example, the data source layer can be a database, a SharePoint list, or a Web service. "