This course will be retired on July 14, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Entity Framework with ASP.NET MVC!
You have completed Entity Framework with ASP.NET MVC!
Now that we've gone through the process of adding repositories to our web app, let's talk about the pros and cons of the repository design pattern and look at an alternative approach that utilizes query and command classes.
Follow Along
To follow along committing your changes to this course, you'll need to fork the dotnet-comic-book-library-manager repo. Then you can clone, commit, and push your changes to your fork like this:
git clone <your-fork>
cd dotnet-comic-book-library-manager
git checkout tags/v3.8 -b alternatives-to-using-repositories
Are Repositories Necessary?
Over the years, some developers have begun to question the value of using repositories. For more information about this discussion, see the following blog posts.
- Favor Query Objects Over Repositories
- Wither the Repository
- Limiting Your Abstractions
- Repositories On Top UnitOfWork Are Not a Good Idea
Organizing Projects By Feature Instead of Class Type
Instead of organizing projects by class type, it's possible to organize your projects by feature. For more information on what this is and how to do it, see this blog post from Tim G. Thomas.
Feature Folders in ASP.NET MVC
YAGNI - You Aren't Going to Need It
YAGNI, or You Aren't Going to Need It, is the idea that you shouldn't add something to your application until you actually have a need for it. Sounds like a simple idea, but you'd be surprised how often as programmers we feel the urge to add stuff that we don't actually need.
For more information see this article on Wikipedia: https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
Code
You can download the code for the ComicBookArtistsController_QueriesAndCommands class from this GitHub Gist.
https://gist.github.com/smashdevcode/3da13530a3d9f5a6860fa1dccffacbdb
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up