Design Patterns - Repository


What is the purpose of the Repository pattern?

The repository pattern is very useful for implementing search methods and mini-query languages. It takes these queries and uses a gateway to obtain the data for a factory to produce the objects you need.

You need the repository pattern when you need to create multiple objects based on search criteria, or when you need to save multiple objects to the persistence layer.

The purpose is to let clients that need specific objects to work with a common and well isolated query and persistence language. It removes even more creation-related code from the business logic.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License