I\'m trying to figure out how the Repository pattern works and how it can be implemented in a custom MVC pattern.
As far as i understand it, the Repository is a layer wh
Your Repository looks much more like a TableDataGateway to me. The idea of a Repository is to be another layer on top of the mapping layer that mediates between the domain objects and the database. It also serves as an in-memory storage of domain objects (something that is missing from your example) and may encapsulate a Factory for creating new Entities. They often also allow for querying the Repository by Specification patterns:
It's a rather complex pattern. You can find good write-ups about Repository in
Also check Good Domain Driven Design samples