C# Project Structure — Part5

iOS
3 min readOct 18, 2021

It’s been awhile and I have been learning a ton most recently C#. In this article, I will explain how I structured an application that consumes and processes data from multiple open source api’s.

To retrieve data smoothly I use a type specific client to interact with each API. The data is de-serialized using a model class which makes the data easier to work with. The response is passed and displayed using an API controller.

This is how I structured the Application:

The Client Folder is used to store third party web api clients that the application gets data from.

Third party web clients

The reason why I decided to create a client for each web api is because it separates requests into types using a controller action pattern. Following the controller action pattern and taking advantage of named type httpclients made development fast and easy.

The other reason why I like separating each client is because I can preconfigure each client by setting DefaultHeaders in the Startup.cs file

Since I can set a base address and create custom headers in the application configuration, keeps the client clean and easier to read.

--

--

iOS
iOS

Written by iOS

iOS Developer, Go, Java, C#, Blockchain enthusiast, Data junkie

No responses yet