Repository Pattern: CORRECT vs. Pragmatic? | Clean Architecture

preview_player
Показать описание
Implementing "interface adapters", specifically the repository pattern, in Clean Architecture correctly seems to be a controversial topic.

While some favor a pragmatic approach by following the concepts of the Hexagonal Architecture, others are tearing their hair, how to implement repositories following the Dependency Rule.

This tutorial explains why the intuitive implementation is probably wrong and how repositories could be implemented being more in with the ideas of the Clean Architecture.

"Implementing Clean Architecture - Frameworks vs. Libraries"

Source code used in this tutorial:

0:00 Intro
0:35 The intuitive implementation
1:22 The problem
3:53 Moving repository to IO layer
4:31 Entities != DTOs
6:50 SQL instead of ORM
8:07 AzureDevOps REST APIs
8:59 Conclusion

Рекомендации по теме
Комментарии
Автор

I am from Android, and I want to say this video about this topic is very clear and the informations are very organized. Thanks.

thecoderui
Автор

Thanks for your video. I like the way you explain how to implement Clean Architecture. When I'm implementing Clean Architecture, I prefer to do the entities to DTO mapping in the use cases layer to avoid leaking domain model to the interface adapters layer. If the entities are going to the interface adapters layer, they may be polluted by their clients in the interface adapters layer and no longer represent pure domain logic. I only keep the entities layer and the use cases layer clean and allow the interface adapters layer to depend on the I/O layer to avoid defining too many interfaces to invert the dependencies. Test automation is conducted in the use cases layer and the entities layer via BDD. I test the interface adapters layer manually because there is only trivial code in the layer.

TeddyChen
Автор

Great.in this case how do we implementation generic repository and uow?

chinthanagunasekara
Автор

Hey thanks for the great video, i have a question, if you were using ef core code first would you then base your DbCotext on the dto's in the apdapter layer?

moellerdk
Автор

Very good analysis. Thank you very much for sharing. Subscribed!

DiegoFernandez-cyfr