There are times more than one repository is used. This often requires to need for a 'generic' repository. This video reviews the code that does just that. This video also lays the groundwork in order to be able to apply the Unit of Work pattern that can be used in conjunction w/ a generic repository.
- [Voiceover] Creating multiple repository classes…for several entity types could result…in a lot of redundant code, and it could…result in partial updates, for example, we do have…another entity besides student, like faculty.…What if I have to update both…as part of the same transaction?…If each uses a separate database context,…one might pass and another might fail,…well one way to minimize redundant code is…to use a generic repository,…and that's what I've created in this instance.…
If we navigate to the DAL folder,…open up generic repository, I also broke down…the code here into several parts.…In part one I declared class variables for the context…and for the entity set that the repository…is instantiated for.…Right below it is the constructor which accepts a…database context instance, and initializes the…entity set variables.…In part 2, the get method uses lambda expressions…to allow the calling code to specify a filter condition…in a column to order the results by.…
Now I won't get too deep in this area because…
In this course, developer and technologist Reynald Adolphe explains the purpose and effective use of eight design patterns, including six Gang of Four design patterns and two .NET patterns. Gang of Four patterns fall under three categories: structural, creational, and behavioral. Reynald helps you learn about select patterns from each category. He describes each pattern and demonstrates how programmers can leverage them in real-world applications.
- Factory Method
- Abstract Factory
- Singleton pattern
- Decorator pattern
- Iterator pattern
- Observer pattern
- Repository pattern
- Unit of Work pattern
Skill Level Intermediate
2. Factory Method
3. Abstract Factory
4. Singleton Pattern
5. Decorator Pattern
6. Iterator Pattern
7. Observer Pattern
8. Repository Pattern
9. Unit of Work Pattern
Convert to Unit of Work3m 53s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.