Showing posts with label Repository Pattern. Show all posts
Showing posts with label Repository Pattern. Show all posts

Saturday, February 8, 2014

Repository Pattern

Why?

 Separate business code from data access
  1. Separation of concerns
  2. Testability

Intent
Encapsulate data access
  1. Data appears to live inside an in-memory collection

Demo

Applicability
Anytime you need data persistence
SQL Database
Web service
File system


Consequences
Increased level of abstraction
  1. More classes, less duplicated code
  2. Maintainability, flexibility, testability
Further away from data
  1. Shielded from infrastructure
  2. Harder to optimize
Related Patterns
  • Unit of Work
  • Specification
  • Identity Map
  • Decorator