Is it good practice to use a generic repository or should each entity have its own repository?
entity-framework, generics, repository-pattern
Solution
This is something that is heavily debated on the internet. If you use the search here at SO you can find plenty of threads about it. In the end is just comes down to your personal preference. Try both options and decide which one is best for you.
I started creating separate repositories for every entity, but it felt like loads of unnecessary work (and lots of code duplication), so recently I started using generic repositories, and that's working out perfectly for me.
See this thread for more information: Advantage of creating a generic repository vs. specific repository for each object?
Problem
Being fairly new to Asp.Net MVC I am following the SportsStore example from the book Pro ASP.Net MVC 3 Framework. All is going fine, but now I start to enhance the base example with some extra entities. Which is the better approach: - should each entity have its own repository (which would seem to duplicate code) or - should there be a generic repository for similar entities? Are there any other projects out there that the same architecture are more complete samples?