Repository Pattern

From "Professional Test-Driven Development with C#: Developing Real World Applications with TDD"

 

In short, the repository pattern states that all data access will be encapsulated into a repository object, which the business domain classes will use to perform any and all persistence work.

Each entity should have its own repository. However, repositories for different types should have similar interfaces and a common base class to help the data access code remain DRY and to make learning how to work with the repository easier.

Repositories can be used with any number of data access techniques, including ADO.NET, web services, and flat file storage.

 

posted @ 2012-05-21 23:14  Bruce Jing  阅读(402)  评论(0编辑  收藏  举报