Repository Design Pattern
Repository Design Pattern separates the data access layer from the business layer by adding an additional layer of abstraction between them. In repository pattern, business logic can access the data object without having knowledge of the underlying data access layer. Possible use cases for repository pattern 1. Underlying data source or data access layer need to change. 2. Hiding the complexity of data access layer. 3. Centralized handling of the domain objects. Implementation Implementation of the repository pattern include following steps 1. Create an Interface IProductRepository. 2. Add abstract methods for CRUD operation like Add(), Update(), Delete() and Get() in above interface as shown below. //Interface for product repository public interface IProductRepository { Product Get(int Id); void Add(Product entity); void Update(Product entity); void Delete(int Id); } 3. Create ProductRepository class which implements IProductReposi...