Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • You don't need 28 repositories, it's not supposed to be a repo per entity. Probably 3-5 or so will do. Organize the repos (and your objects) around your use-cases, so that for a use case a repo can return the objects you need together (in one or in a few method calls). E.g., his MusicRepository.GetAllWithArtistAsync() returns Music objects and the associated Artist objects. The top-level objects can, but don't have to be EF entities. Commented Oct 29, 2020 at 21:26
  • No matter what architectural style you use, an application 28 entities is going to have a lot more code than one with 2 entities. I personally don't use the generic repository pattern and unit of work pattern that the author uses, but his approach is pretty solid in general and pretty common in the industry. Commented Oct 30, 2020 at 3:09
  • @EricKing thanks for the comment. I've come accross to one of your answers to a similar question and the accepted answer here. However it has been 8 years since that. Could you let me know if your answer is still valid for that question? If not could you answer the very same question in today's time? Commented Oct 30, 2020 at 6:25
  • @FilipMilovanović thanks for the comment. So how can I implement this idea with a generic service? (if it is possible of course) He also registers services in the Startup.cs As you said, for most of the entities the generic repository is more than enough form me as the need for anything other than the basic CRUD will not be needed for ever. But I am quite new to the concept to figure out how to implement it to this code. Any ideas? Commented Oct 30, 2020 at 6:57
  • Since you mentioned EF and Repository/UoW, you might want to read this answer: Why shouldn't I use the repository pattern with Entity Framework? Commented Oct 30, 2020 at 7:50