0
votes

I'm reading through Repository pattern at The Repository Pattern

Under the Solution section, its mentioned

The repository mediates 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.

So, is it apt to call the Dataset an example of Repository Pattern. Also under objectives section I found

You want to maximize the amount of code that can be tested with automation and to isolate the data layer to support unit testing.

which, can any one explain with examples ?

Thanks a zillion

1

1 Answers

1
votes

Answer: No, they serve different purposes.

Dataset represents an in-memory cache of data and doesn't provide methods to modify data.

In contrast, Repository provides methods to operate with data: objects can be added to and removed from the Repository, as they can from a simple collection of objects, and the mapping code encapsulated by the Repository will carry out the appropriate operations behind the scenes

ps: you may find my answer to be not language-agnostic, in this case please provide more details along with your question