Repository Pattern
Status: draft · Confidence: low (0.53) · Basis: verified_sources
Quality notes: generic_source_homepage, no_verified_sources, partial_source_verification
## TL;DR The Repository pattern mediates between the domain and data mapping layers, acting like an in-memory collection of domain objects. It abstracts data access, enabling swapping data sources (database, API, in-memory) without changing business logic. ## Core Explanation Provides: collection-like interface (add, remove, find), query methods, separation from ORM. Often combined with Unit of Work pattern for transactional consistency. Generic repository: `Repository<T>` with common CRUD. Overuse can lead to anemic domain models — prefer rich domain models with behavior. ## Further Reading - [Patterns of Enterprise Application Architecture](undefined) ## Related Articles - [Adapter Pattern](../adapter-pattern.md) - [Command Pattern](../command-pattern.md) - [Decorator Pattern](../decorator-pattern.md)