Member-only story
How to use startup.cs with Clean Architecture
Almost every time one company or people call me to help them with their sides project, they have clean architecture. Usually, they don’t really need that type of architecture. I guess they use it because clean architecture is mainstream…
If my neighbor has a chicken I want a chicken as well.
Stepping aside from mainstream stuff, often they have a single startup.cs file, for the entire application.
This is not wrong, but you can make your life easier and make your application more readable and maintainable. I have seen startup files with more than 1000 lines of code. You can say, that the startup file doesn’t update that often. I kinda agree, but when you update you will need to read all 1000 to find want you to want.
One file with so many responsibilities(SOLID principles).
If you choose the Clean Architecture because you want to separate the application into different layers correspondingly each responsibility.
If you separate your application into different layers to get each layer one responsibility, why do you have only one startup file for the entire application? Don’t make sense. I’m not telling you that you should have a startup file of each layer. But create a startup file where you need.