The repository pattern is very useful since the introduction of OR/M libraries. A repository mediates between the domain and data mapping layers which acts as an in-memory domain object collection. The Client objects construct query specifications declaratively and submit them from the Repository for satisfaction. Objects are then added to and removed from the Repository, as they can from a simple collection of objects and the mapping code encapsulated by Repository will be carried out with appropriate behind the scenes.
The repository pattern is an abstraction. The purpose of it is to reduce the complexity of the code and make the rest of it code persistent ignorant.
Read the rest of the post here:Â http://www.codeproject.com/Articles/526874/Repositorypluspattern-cplusdoneplusright