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

258,294
123
2021-02-01に共有
Become a Patreon and get source code access: www.patreon.com/nickchapsas
Check out my courses: dometrain.com/

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.

Clean Architecture by Jason Taylor: github.com/jasontaylordev/CleanArchitecture
Clean Archutecture by Steve ardalis Smith: github.com/ardalis/CleanArchitecture

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:
Follow me on GitHub: bit.ly/ChapsasGitHub
Follow me on Twitter: bit.ly/ChapsasTwitter
Connect on LinkedIn: bit.ly/ChapsasLinkedIn

#dotnet #csharp #cleanarchitecture

コメント (21)
  • 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.
  • @shayvt
    Can you please make a video on Unit Tests and Integration Tests architecture, best practices, etc.?
  • 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!
  • 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.
  • Thank you Nick for this and other videos! And also thank you other ones for commenting additional tips/advises! ❤❤❤
  • 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.
  • 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.
  • 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.
  • @sarbjeet7
    Only video that help me understand infrastructure layer practically👍🏻👍🏻
  • @umut9780
    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.
  • 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!
  • This is a great video! This kinda information is provided only by people really working on project architecture.
  • 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!!
  • @rvkrasyl
    Круте відео, дуже дякую за пояснення
  • 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.