How I Use The Generic Repository Pattern In Clean Architecture
Milan JovanoviΔ
βοΈ Master the Modular Monolith Architecture: https://bit.ly/3SXlzSt
π Accelerate your Clean Architecture skills: https://bit.ly/3PupkOJ
π Support me on Patreon to access the source code: https://www.patreon.com/milanjovanovic
The generic repository pattern is precisely that – a repository pattern implementation that is generic. You won’t benefit much from implementing it on top of EF Core.
Specific repositories are a different story, and they’re common in DDD. I’ll explain in the video how I use the specific repository pattern and use the generic repository pattern to reduce code duplication.
Join my weekly .NET newsletter:
https://www.milanjovanovic.tech
Read my Blog here:
https://www.milanjovanovic.tech/blog
Subscribe for more:
https://www.youtube.com/@MilanJovanovicTech?sub_confirmation=1
Chapters
0:00 Specific repository in the Domain layer
1:26 Using the repositories in use cases
3:25 Why I like Specific repositories with Clean Architecture
5:13 Specific repository downsides
6:06 Creating a generic repository with EF Core
8:40 Refactoring to use the generic repository
11:04 Strongly typed IDs with generic repository
15:45 Solving breaking changes with Extract Interface refactoring