How to structure a .NET Solution (project separation & architecture)

preview_player
Показать описание

Hello everybody I'm Nick and in this video I will talk about how I organize my .NET solutions. This solution organization is not the only way you can go about it but it is one of the most widely adopted ways of implementing a Clean Architecture.

Timestamps
Intro - 0:00
Solution folders - 1:17
The layers - 2:34
The Domain project - 5:07
The Application project - 6:17
The Infrastructure project - 7:34
The Presentation project - 9:10
Recap - 10:36
The tests - 11:44
Contracts & SDK - 12:53

Don't forget to comment, like and subscribe :)

Social Media:

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

Hey everybody I just wanted to make something clear in case it wasn't clear enough in the video. I also don't agree with the use of Entity Framework for the project. The video focuses on the projects, layers and concept more than it focuses on the actual tech used. You can remove EF, MediatR and any other piece of tech but as long as you keep the idea behind it as it is, the concept still stands.

nickchapsas
Автор

Now THIS is a rare find. Almost nobody talks about how to structure your projects, but it is actually quite important, especially for new team members trying to familiarize themselves with an unfamiliar codebase. Excellent structure and lesson! Cheers!

Chiramisudo
Автор

Can you please make a video on Unit Tests and Integration Tests architecture, best practices, etc.?

shayvt
Автор

Awesome video! I've been working as a professional dev for 1.5 years but I've felt I've been lacking in architecture for a while now. These videos really help.

Imafriggingoddess
Автор

Thank you Nick for this and other videos!
And also thank you other ones for commenting additional tips/advises!

❤❤❤

justwatching
Автор

I just stumbled upon this video and it is great, I have been using this approach for a while now and I find it great. Only in the case of api applications I recently started using the minimal api approach that came with net 6. The WebUi project is much simpler this way.

juancarlostorrescuervo
Автор

Hey Nick, you earn a subscriber, this is really one of the topic who never talks, I also struggled at my initial phases of carrer why that domain is there, what is this Infra and all. but thanks to you. nice clarification.

satishbhuktar
Автор

Thanks Nick, This is very clear of explanation for architecture.

karimpeymani
Автор

Please make a video on best practices in Entity Framework. What mistakes do people usually make and what practices should be avoided? Please. Great videos!!

junaid_aslam
Автор

I don't think people realise how valuable and important these kind of guides are, and it's unfortunate how they do not go to enough detail on this exact topic the way you do. As a dev you learn to code first, how things work, you chuck your code everywhere all willy-nilly to just make it WORK. But it gets to a point where once you get that experience, learning how to do things the right way is very important too. Thanks for sharing content like this!

Also this is one approach, a very good one at that. There are also other approaches which are very good too because they share similar principles.

umut
Автор

that's what I was looking for, keep going great content

abdelhaleemalfreihat
Автор

Short and clear explanation. Thank you, sir.

PyaePhyoAung-xifh
Автор

I use the project structure and dependencies as outlined in this video with one difference. I add a project "DependencyInjection" which references: Application, Domain and Infrastructure. Then WebApp only needs to reference Application and DependencyInjection.


To ensure that the dependency references are maintained going forward, I write Fitness Function tests that check that the dependencies between the projects are not violated. It is extremely easy to inadvertently break these dependency rules.

darylolson
Автор

Hi Nick, can you post or share a full implemented example of how you use the Application + Contracts + Client + SDK + WebUI in a API Solution scenario ?
Very good content, congratz!

rogeriobarretto
Автор

This is a great video! This kinda information is provided only by people really working on project architecture.

TheSiddhaartha
Автор

This is great. I have a similar setup for what I work on. The key difference is I manage a suite of apps that share domain models, repository access, logging etc. So I have those common things in a separate solution. Those projects are now NuGet packages hosted on GPR. So practically 0 code duplication for these common things and a simple way to deploy changes.

For dev, I have a post build script that copies the .dll files to the appropriate folder in the nuget cache, so I can test integration immediately.

ryanjohnson
Автор

You learn much more when you read a good book later. I saw this video previously maybe one year ago, now I've watched it again and god I see things differently now.

Thank Nick for your great contents.

thefarhadfarhadi
Автор

Only video that help me understand infrastructure layer practically👍🏻👍🏻

sarbjeet
Автор

thanks for sharing. Very helpful and a good starting point

whlers
Автор

Good work Nick. When it comes to DDD and Clean Architecture I love this setup! I do have another layer for cross cutting or can setup modules for each layer for DI if needed. Keep up the good work pal!

sunnypatel