I am a little bit confused between the repository pattern and the Entity Framework.
In this answer, I have learned, it is bad to create a repository on top of Entity Framework for these reasons:
- EF implements
UnitOfWork
- EF implements a generic repository
- The
Repository
pattern is for abstract the database away from the business logic, which Entity Framework does
Instead of creating a repository on top of EF, we should use a service.
Now the problem:
What is, if I decide for performance reason to replace some Linq query with a stored procedure call, like mentioned here? This answer suggest to use some kind of repository pattern.
It feels dirty, if I would call a stored procedure directly in the service layer, since the database would no longer be abstracted from the business logic.
How would I abstract the stored procedure call? Or is it ok, to call it from the Service layer?