The Repository Pattern is used 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 repository acts as a mediator between the data source layer and the business layers of the application.
It queries the data source for the data, maps the data from the data source to a business entity, and persists changes in the business entity to the data source. A repository separates the business logic from the interactions with the underlying data source or Web service. The separation between the data and business tiers has three benefits:
- It centralizes the data logic or Web service access logic.
- It provides a substitution point for the unit tests.
- It provides a flexible architecture that can be adapted as the overall design of the application evolves.
More to come…please stay tuned.