vendredi 5 mars 2021

Why use repository in ASP?

Why use IRepository i have always used services and created interfaces for different services. For example SqlProductService ISqlProductService. Why use generic repository what if lets say SaveToDb() does more than just save entity maybe it expects product and maybe it does some calculations specisifc to product entity or adds it to a cart if that is generic then it would be very bad if i passed another entity instead of product. So i dont't understand why to use Repository instead service for each entity/model. Can anyone explain to me?

Aucun commentaire:

Enregistrer un commentaire