Click here to Skip to main content
15,888,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working with Repository pattern in my desktop project's , but i faced some problems with this pattern 
earlier i read many articles discuss that this pattern is dead
so , i tried to find what's the alternative ? what is the suitable pattern can i use to make my code clean , maintainable ? Now i'm so confused ... i'm waiting your advice.
thanks a lot.


What I have tried:

directly ef db context , without any pattern
Posted
Updated 19-Nov-20 3:52am

Why does there have to be a pattern?

Once a newb here's the word "pattern", they typically forget about solving the problems in their code, forcing their code to fit a certain pattern and layers of abstraction instead of just forgetting about that rigid framework and just write code that works.

EF Core already implements the Repository pattern anyway, so why would you wrap it in another pattern?
 
Share this answer
 
"Repository patters" are optional; they're not "obsolete".

They "abstract" data access; meaning, they make it "simpler", when they can.

Instead of a bunch of EF Contexts or SQL connections, one just does a "get" or a "save" to the "repository" (i.e. the data accces layer).

If someone's idea of a "repository" sucks, and I have to work with it, I may very well build a "repository" over their (crappy) repository so it works the way I want to.

Patterns are to make your life easier, but only when you can see the point.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900