Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What's the difference between repository abstraction and base repository?


Asked by Gideon Woodard on Dec 10, 2021 FAQ



The repository abstraction allows you to pick the base repository totally driven by you architectural and functional needs. Use the ones provided out of the box if they suit, craft your own repository base interfaces if necessary. Stay away from the store specific repository interfaces unless unavoidable.
And,
Both repository and database is used for storage of data - only difference is in repository where the data can be appropriately tagged and stored - making it easily accessible.
Just so, An example that uses repository pattern to store and retrieve data from sql server database Repository Pattern is an abstraction of the Data Access Layer. It hides the details of how exactly the data is saved or retrieved from the underlying data source. The details of how the data is stored and retrieved is in the respective repository.
Also,
Martin Fowler defines a repository as an “object that mediates between the domain and data mapping layers”. The objective is to isolate domain objects from details of the data access code. However, the generic repository can allow developers to wrap the underlying data access technology such as Entity Framework classes.
Thereof,
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.