Techiio-author
Started by Gibson DavidsonNov 3, 2021

Open
.NET Repository Pattern and Http Requests

2 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 2 VIEWES SHARE

I'm seeking to one hundred% recognize the styles of structure in the. Internet global. The repository's most important code of the repository sample as far as I realize is commonly created inside the infrastructure layer, for facts get entry to, no longer best to databases but other cases as properly. Nowadays, I have the most effective visible it being used to get right of entry to to the database, however, I would like to look if feasible, multiple different examples for whilst the usage of a repository magnificence.

Proper now, for example, I am building an application that does HTTP requests to multiple different APIs. I have a website/center layer and an infrastructure layer. What will be the first-class exercise in this case for the HTTP requests class? Need to there be repositories for the HTTP requests verbal exchange training? Or is there some other pattern to comply with within this situation?

If possible and someone ought to give some greater distinct cloth on this subject I'd be thankful. I've searched a lot and all I'm able to discover is constantly the same database simplest related repository get entry to.

1 Replies

Techiio-commentatorPritam Dhar replied 4 months ago0 likes0 dislikes

Not sure what is the best practices for this kind of a usecase, but recently I have build something similar. So basically I have folder named externalRepositories inside Infrastructure project which contains mainly three things (per host):

SomeHostHttpClient - maybe not necessarily in your case, but I'm using it for authentication, retries in case of 401/403 and logs requests/responses

SomeHostExternalRepository - handles api requests for a host, checks the response and deserializes object.

SomeHostMappingService - used to map from response dto to entity with additional requests to db for references and so on. Probably this should be inside external repository as private merhods and repo should return entities, I just wanted to separate these two by their responsibilities. But now it introduces some confusion and additional knowledge of implementation

Not saying that it is the correct solution, just sharing my experience within this topic.

You must be Logged in to reply
Trending Technologies
15
Software91
DevOps48
Frontend Development24
Backend Development20
Server Administration17
Linux Administration28
Data Center24
Sentry24
Terraform23
Ansible83
Docker70
Penetration Testing16
Kubernetes21
NGINX20
JenkinsX17
Recommended Blogs
1
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance