Typescript Design Patterns: Repository design pattern
HTML-код
- Опубликовано: 25 окт 2024
- In this video, I will walk you through the Repository Design Pattern in Typescript. You will learn about separating your Data logic and your ServiceClass logic. If this kind of content is useful to you, please support me by giving me a like and subscribe to my channel!
And as always, Thanks for watching!
#typescript #designPatterns #repositoryDesignPattern
Service should consume the repo, not the other way out
I can't believe how clearly you can explain these concepts. Excellent video, thank you!
thanks, i haven't made any videos in quite some time but am considering continuing
Wouldn't it be the other way ? Repository should get data from api since it's a data source, then it's the job of the service to process and map the data and passes it to the service?
Curious about why the repo should depend on service layer?
Great explaination, thanks!
One question Jaime, in the StudentRepository class you pass in the constructor the interface iStudentServices, and then in line 33, you're using the getStudent method from StudentServices class, but I can't see where are you passing a new instance of that class to the Repository. Hope you can help me to clarify that! Anyway, great video, thanks for sharing!
Ты путаешь принцип паттерна. Репозиторий не может вызывать сервис. Сервис делает валидацю входящих данных и передает их в репозиторий, а репозиторий тем временем уже обращается к хранилищу данных (API, DATABASE).
I think it should be other way around
Service -> Repository
Not Repository -> Service.
Thanks for your video anyway :)
Hello this is wrong! Service is consuming Repo!
Need real use examples ..
Muito bom! Nota zero