Clean Architecture With .NET 6 And CQRS - Project Setup
Вставка
- Опубліковано 8 лип 2024
- Get the source code for this video for FREE → the-dotnet-weekly.ck.page/ca-...
☄️ Master the Modular Monolith Architecture: bit.ly/3SXlzSt
📌 Accelerate your Clean Architecture skills: bit.ly/3PupkOJ
🚀 Support me on Patreon to access the source code: / milanjovanovic
You've heard about Clean Architecture before? In this video, I'm going to show you how to set up the Clean Architecture using .NET 6 and CQRS with MediatR.
How I Approach Clean Architecture Folder Structure
www.milanjovanovic.tech/blog/...
Join my weekly .NET newsletter:
www.milanjovanovic.tech
Subscribe for more:
ua-cam.com/users/MilanJovano...
Chapters
0:00 Introduction
0:19 What is the Clean Architecture?
2:51 Domain layer
5:01 Application layer
7:26 Infrastructure layer
8:25 Presentation layer
12:02 Outro - Наука та технологія
Master the Clean Architecture: bit.ly/3PupkOJ
Quick update to the people, now after 3 months of releasing highest quality content, there are 4873 .NET engineers receiving those amazing tips (including me)
@@lukagolubovic3641 4961, forgot to update the website. 5k before #014 goes out, hopefully 😁
Hello, I'm new to your channel. Do you have a project on Git that I could check out?
Wow! I'm glad you started the UA-cam channel.
I was always wondering how to avoid referencing all the layers into web project and your explanation helped to isolate into different project and register in the web. Excited for the entire series!!! Looking forward to the next video!!!
Thanks! I'm glad you liked this one. The coming videos will be much more practical (and useful), but I needed to set the stage somehow with this one.
The idea for separating the presentation layer from web is genius. Glad learned something new today. Thank you for sharing.
I'm glad you liked that idea 😁
@@MilanJovanovicTech i cant understand purpose of seperation 'Controller'. Can you please explain me more in plain english or more in easy to understand language. Thanks
Nice, I use Node JS thought but this content its pure gold, not many channels have videos on how to implement clean arch. Keep rocking!
Thanks a lot, Daniel!
Thanks, Milan looking forward to watching the whole series about this exciting topic
Thank you Cesar! More exciting videos are on the way 😁
Great video quality! I'm sure your channel will grow exponentially, it's just a matter of time! Keep up the good work!
Thanks a lot Pedro!
I learned how to use folders (model, core, helper, config, context, dbContext, migration, service) and create new libraries (I connect them through Project Reference). After your video, I realized that I still have a lot to learn.
There's always more to learn, and that's a beautiful thing :)
Congrats Milan! I believe we have many things to learn from you. Keep going ✌💪
Thank you 🙌
Well done Milan! Congrats for your second video!
Thanks Saddam, hope you liked it!
It is so nice that things have evolved to a point where we have good name for this now, I have been doing this for years and years and it was really just a collection of design patterns at the time. My favorite thing about it has to be the separated interfaces pattern, I really like having implementations in the infrastructure and the interfaces in the domain. I like the way you think about this and your presentation, you have earned my sub.
Hey Tommy. I do have a question for you. How do you group your entities in the Domain layer?
I showed an example here where all of them are under the Entities/ folder. But I've gotten some pushback on this approach in favor of grouping by feature/context.
@@MilanJovanovicTech honestly it depends on the app, but for a large enterprise app I favor by context, improves maintenance imo. For microsevices that makes less sense imo.
Finally, someone that actually cares about seperating the 'Configuration' from the presentation- I've been arguing this for quite a while among colleagues and friends- Finally nice to see someone agreeing, and actually having a good case where it makes sense! - Also nice quick overview of Clean Architecture- Thanks :-)
A man of culture I see! 😁
Awesome video! Can't wait for more videos about Clean Architecture!
Thanks a lot Nikola!
I'm new to clean architecture, and your video helped me to get the basics pretty quick.
Glad I could help!
Using Repository and UoW abstraction, I love that approach because it gives some benefits
I agree, but some people seem to hate them 🤷♂️
It's a never ending debate, but if it serves a purpose then we should use it. End of discussion 😃
Excellent tip on the controllers Assembly. Good stuff!
Thank you. It's unfortunate how unfamiliar people are with this.
Great video, I hadn't seen other examples of moving the controllers to a different project, learnt something new! :)
That's awesome, I'm glad you liked it!
such an amazing simplified video, thanks a lot (from a junior perspective)
I'm glad you found it useful :)
Awesome work Milan!
Thank you so much for the support Ryan!
I liked how the WebApplication with the Clean Architecture really stands up for its name, It's less complex and more organized to create, maintaing and scale. Liked a lot!
Im watching your vids to study and it's really helping me in my university's work
Glad you're enjoying it :)
Thank you Chris. I really appreciate it and that was exactly what I was trying to do. No fuss and helping people get on with what they need
Awesome. But who's Chris? 😁
Great video. Go on!!! Architecture is a very important topic in sotware discipline. Your examples are simple but cover the important concepts in way that is simple to understand. Good job!!!!
I'm planning to expand on this in more detail in the future videos. We'll also cover some other architectures, I personally really like Modular Monolith.
Modular Monolith. rocks!!!!
Well done Milan! Congrats 👏🏽👏🏽👏🏽
Thanks Lucas!
Thanks...We wait for next videos.
Coming out on Tuesday!
As a member of your Patreon,
I learned the basics of CQRS and how to build minimalist API.
Because of this, I got the job offer from my new work.
Thank you.
You are crushing it, congrats! 🔥
Can you share where and how did you apply?
Clean explanation for clean architecture, thank you milan for such a great video
Glad you liked it!
Very grateful for your content, the best successes Milan😁
Thank you very much, Fernando!
Great video , please keep posting videos like this.
Next video is coming out today - how to add DDD to the Clean Architecture
Great video! Thank you for sharing with us.
You're more than welcome 😊
Thank you
Any time :)
Tks for vídeo ! Hug from Brazil
Thanks Ramon!
Great video Milan! Thank you so much for sharing.
Thanks, I'm really happy you liked it. What was your biggest takeaway from this one?
@@MilanJovanovicTech Your explanation about why to define controllers outside the web application project was pretty good. I will apply this concept in my job. Thanks.
Great video!!! Thanks for sharing.
You're welcome!
Respect my bro
Thank you!
Thank you!
You're welcome!
Interesting topic 🙌
Indeed Mika!
You have a neat setup for the project. One thing I would change is where the commands are defined. I'm using event sourcing, so I have a strong relationship between domain events and my entity. I send commands to my aggregates that get translated to domain events. Because I'm using this pattern, I like to keep the commands and the events close to my aggregate.
I never worked with ES so not sure if that makes sense or not 🤔
Great video
Thank you!
Ajde da te pohvalimo i na srpskom :) Pratim te već nekoliko meseci na LinkedIn-u i zaista sam uvek uživao čitajući tvoje objave u vezi sa kodiranjem. Ovo je sada next level i svaka ti čast. Odličan video i super objašnjavaš. Želim ti puno uspeha sa ovim kanalom i jedva čekam sledeći video. Poz od bivšeg kolege iz HTEC-a :)
Hvala puno Miloše! Jako mi je drago da ti se dopada video. Ja još uvek vidim tu puno prostora za napredak, tako da očekuj da će samo biti sve bolje sa vremenom. Zašto bivši kolega? Šteta. 😁
@@MilanJovanovicTech Naravno da ima ali za pocetak sve je super :) Htec je zaista super firma i stvarno je pamtim po svemu lepom, ali ukazala mi se prilika i ponuda koju nisam mogao odbiti, tako da sam nastavio svoju karijeru u drugoj firmi :) Srecno sa ovim kanalom i samo tako nastavi. Poz
Great Job
Thanks!
Great video 👍 thankyou
You're welcome! 😊
Thanks for this video, that helped me alot.
Awesome, I'm glad to hear that :)
About controllers outside of the web project... You could handle the dependency injection inside the infrastructure and make the web project to reference only the infrastructure. That way you would be able to have the controllers inside the presentation web.
You'd still need to reference Infrastructure from the Api and the same problem happens
Very neat video, Milan, presenting some nice ideas like separation of presentation logic from the host application, and validation as middleware!
I wonder why you choose to define IRespository and IUnitOfWork in the domain layer though?
For me, this polutes your domain with concerns that start in the application layer. A tell-tale sign is when you start to see Task or ValueTaskT> in the domain - we're starting to leak IO concerns into our domain.
Another way of looking at it - no logic in your domain is dependent on these abstractions. If you deleted them the domain would still build. It's a sign to move them outwards.
I look forward to seeing more of your ideas here!
Thanks Pete! I like to define the repository interfaces there as a sort of convention. There isn't any practical difference if they were defined in the Application layer.
But for Task in Domain layer, I tend to not shy away from this. Yes - I am introducing impurity in the domain. This is usually through double dispatch, which I often use. I find that this is easier for testing purposes, and keep the Domain pure from Task doesn't yield any actual performance benefit. You would still perform the IO call one layer up.
I guess it comes down to how comfortable you are with using Task in the Domain, and how you approach modeling the Domain in general.
At the end of the day, both of our approaches will work the same.
@@MilanJovanovicTech Task in the domain is the lesser problem here - it's the presence of IRepository and IUnitOfWork.
You say you put them there by convention and it wouldn't be any practical difference to move them out to the application layer. But consider your motivation for separating the presentation layer from the infrastructure layer to prevent a developer being able to access infrastructure concerns.
To me this is a very similar context - what's to stop a developer who doesn't yet comprehend what the domain is for from deciding to include a LoadAsync method on a domain entity and pass in IRepository because they saw it in the domain and thought it must be used there?
@@petewarner1077 That would be tragic indeed. I will honestly have to ponder on this to see what conclusion I come up with. Maybe I end up moving it to the Application layer. 🤔
@@MilanJovanovicTech I wonder what do you think about this topic today Milan :)
thanks! subbed.
Welcome to the community! 😁
My main problem with CQRS is that i will have to code alot for simple things. If i need to add something i would need to see in detail where this interface is because its deep down the commands or w/e.
So i do a mixture of clean architeture with the normal 3 layer and i normally have the infrastructure layer with my repo, external services(email etc) and my application layer would only deal with the business logic using the repos interfaces(contracts) to persist data.
Of course, that's a great way to implement the Clean Architecture 😁
I work in a similar way.
I think the key is to pick what works for you. There is no "correct" way to do it.
Good video
Thank you!
Thanks for posting this video and making this clear architecture more precise. Can you pls mention the benefits of using these pattern versus others ?
Will cover in some future videos :)
I lke it :) Thank you
Awesome! There's a whole series of videos on this topic coming
Dear Milan! I have so much trouble with clean archi. I really think it’s difficult to handle, difficult to maintain especially with teams nowadays that are a lot composed by juniors 😅 but thank you very much for this video. I’ll dive deeper into it !
Why do you find it difficult? What part is the most problematic?
Hi Milan,
I like the "trick" of separating the Presentation layer from the composition root. But there are also two things that I'm not so sure about:
1. Don't you think, that persistence-related abstractions, like IRepository and IUnitOfWork should be placed in the Application layer, instead of the Domain layer?
I think that the Domain layer shouldn't know anything about the persistence, even if it's only a contract. In fact, the Domain layer doesn't have to know if it's persisted at all :)
2. Some persistence logic in your QueryHandler in the Application layer - shouldn't we move it to the Infrastructure layer?
Persistence logic is in fact something related to external dependencies, so you're breaking the idea of separating the Application layer exposing interfaces from the Infrastructure layer containing implementations related to all external concerns.
Also, I would consider making your Application layer more explicit and using Result monads instead of relying on middleware from the Web project to catch everything and translate it to a proper response code. This is not entirely bad, but at least opinionated in the community : )
Thank you for this brilliant comment! Let me address each point.
1. I don't think this is the case. I look at the repository as a "contract" of what you are allowed to read from the Domain layer. I don't use the repositories on the query side. So the repository for me is a contract of: here are the entities you can read, here is what you can do with them (add/update/remove), and here's how to commit the changes (unit of work). The repository is just an abstraction. In that sense, I find that it doesn't pollute the Domain layer.
2. I agree with this. This was a naive example, and I probably should have used something more robust. I will cover implementing the Application layer in a future video, and on the Query side, I want to show how to abstract data access completely.
3. I covered the Result object approach in my latest video "Domain Validation with .NET". I plan to use this approach going forward, so we are aligned on this one.
How can I reach you? Would love to learn
Brilliant discussion, thanks to both.
@@MilanJovanovicTech I've seen both use cases to place the repositories interfaces in the domain and application layer. And in my experience, it depends. If the repository is as true to the pattern as possible, it belonging into to domain layer makes sense.
As for the Result object vs Exceptions, it also depends. In some message driven applications using something like nServiceBus or MassTransit using exceptions is very usefull.
In Rest based services/front end facing services, using a result object can make more sense.
But sometimes a domain exception is used like a comuflaged goto statement.
In my current project, errors are handled as domain exceptions, except for in our BFF applications, were the domain exceptions are translated in something more atune for the front-end
@@jakkepiet I put my repository in a SharedKernel project that every bounded context depends on. This project is a bunch of contracts, like IRepository, EntityBase, IAggregateRoot and other commonalities between BCs.
New subscriber here. Thank you
Awesome Jerald, thank you!
Hi Milan. I'm a Cuban developer that follows you since the beginning of your work on LinkedIn. I'm very interested in this topic and these videos I will be happy to support you on Patreon to get access to your code. But Patreon is blocked for Cuba and I can't use a popular method of payment cause we don't have Visa or Mastercard. If you have another platform that supports crypto payments to support your work it will be great. I will start a new project in my actual job and I wish to have this code for better understanding. Thanks for sharing your knowledge with the community and made this awesome job. Keep doing it.
Send me an email
Hi Milan, Just a feedback that there should be a beginner series as well. Its really not easy for beginners to start learning from your videos, specially me who started just few days back.
That's fair! I'll work on that in the future :)
Just to point out here - architectural design patterns is not something you learn having a few days of experience in programming. Those concepts require some maturity and background in the spehere
Great video!
Can you please please show how to setup Serilog logging in this project structure throughout all the projects?
Sure thing, I can cover that in some future video :)
Great video. Just curious,
1. Have you used this pattern in large team?
2. Where the new team members able to pick up the code easily?
3. Everything has downsides, what are the downsides of this Architecture in your opinions?
1. Depends what you consider large? I used this in a 10 man team, and it scaled very well.
2. That was actually the biggest compliment they had - it was very easy to get up and running, and start contributing.
3. Too complex for simple CRUD apps, so choose wisely
Hello Milan, I enjoy watching and learning from your educational videos! :)
Would be very nice with a Github repository for each video.
Pozdrav
Check the pinned comment :)
This introduction part is great. KUDOS TO YOU...
Where is the next video for implementation part ???
Check out this playlist: ua-cam.com/play/PLYpjLpq5ZDGstQ5afRz-34o_0dexr1RGa.html
@@MilanJovanovicTech yes I am going thr that immediately after this video....
G8 content
Subscribed! Please post more videos, like Web Api
Heard you loud and clear, more videos on Web APIs incoming!
Hello, buddy. Congrats for the video! Any special reason to use .NET Core 5 instead of 6? Or, are you using 6 with a startup class?
Hey Ricardo, this is .NET 6 actually. I just used a project with Startup/Program class. The other examples moving forward will be with minimal startup approach. 😁
Thanks for great video. I have a question on CQRS Pattern. The business wants me to implement Upsert feature. I need to first READ and then WRITE based on the retrieved object. Is it going to be command or query?
Looks like a Command to me!
Great channel! Few questions though :) Are there any plans to create and share maybe one git project for this that will follow these tutorials? Also, would it be possible to show in one of the next videos an example of how third-party integration should be done with this type of infrastructure, for example, simple integration with email sending service? Cheers
Thanks for the questions, let me address them one by one.
1. The source code is currently available for my Patreon supporters. However, I do have some more involved examples on my Github: github.com/m-jovanovic
2. Yes, that's a great idea. And I will definitely go over an implementation like that, email seems to be the simplest approach.
Absolutely amazing! I'm wondering what theme you're using... could you share? Tks!
It's ReSharper
Great video keep it up.
I just have one question as a beginner with clean architecture : why Application layer contains use case implementation ? what if we want to change db implementation, aren't we supposed to just alter the implementation with the new one without modifying the core ?
The use cases should ideally depend on abstractions only. That way, you only have to change the abstraction implementations and the Core would remain unchanged.
Great Job!! keep it up. I have a question how can we use database stored procedures in clean architecture, some of my business logic is in stored procedure. Thanks in advance for your valuable advice.
Call it from a service, or call it directly
TO START WITH, Great content, and thanks.
What if someone does not like to use CQRS. What will the controller use to send (query) to eventually hit the DB? Is Repo pattern a solution? Or do you have any advice?
Repo/service approach will be your best bet
Hi Milan, I'm a bit confused. How do you add dependency injection for your DBContext? Won't it break Clean arch pattern if you reference the DBContext in your web application?
I do it through interfaces so that my Application layer doesn't reference the DbContext
Nice simplified Video,
Just a question, why did you use parameterless constructor in Webinar class?
For EF Core, so that it can initialize the entity when querying
Is it better to have a Service Layer to handle complicated update commands logic?
and define the service abstracts in the Domain Layer.
It depends
Great video Milan! I have 2 questions:
1) Why Dapper is used in Application Layer(which is part of Core) if our Core should be independent of libraries and frameworks? Would be a better approach if we use 2 separate interfaces for read/write (IReadRepository, IWriteRepository) and implement them in Infrastructure layer (e.g. EF for write, Dapper for read)?
2) What is differences between Domain services and Application services when we not following CQRS approach, and could give some short examples of both?
Thanks!
1. I don't think SQL (Dapper) is as heavy a dependency as EF is. I can also easily mock the call to IDbConnection. With EF it's quite difficult. I will cover an approach in a future video for completely "cleaning" up the Application layer from all external dependencies.
2. Domain Service is defined in domain, and so all it's dependencies also have to be Domain concepts. It's usually a blurry line between Domain/Application service. What I usually do in Domain service is when I need to manipulate more than one entity, but there is not natural candidate for an "Aggregate root" - then I introduce a Domain service. For Application service, it's the same as Command/Query handlers.
@@MilanJovanovicTechThanks for nice clarifications. Keep going with nice work.
Thank you Milan, really informative.
Just a question, isn't the private field in 10:01 able to work also in the case ?
The compiler does not complain. Or if you would build the project it would complain?
What projects are you reference in the Presentation layer?
It would fail at compile-time, there isn't a reference to the project where it's defined.
@@MilanJovanovicTech Makes sense!
Thank you for the clarification :)
Hi Milan, I see in your LinkedIn that you have Clean Architecture, CQRS and RabbitMQ. In my company, we use NServiceBus with RabbitMQ as the transport. My question is: where to place the NServiceBus message handlers? Currently, we have them in the Presentation layer. I believe we should put them in the Infrastructure layer and then use the Application layer to carry out the tasks. Would be very keen to hear your take on how you've done it in the real world.
We just place them in the Application layer, since they will contain business logic usually. Yes - this does introduce an external dependency in the Application layer but it's a tradeoff we made.
Your approach also works fine.
@@MilanJovanovicTech Thanks Milan. By the way, your channel is fantastic and is an inspiration to get more into DDD. Thanks and I wish you all the best with it and your career.
I may have missed this but what layer should Errors\Result be part of? In another video saw you used a SahredKernel project
Domain/Common/SharedKernel - not so important. What matters it that it's somewhere where other layers can reference it. In this case, it's the Domain. In another video, I moved it into SharedKernel.
Hi Milan,
I have been following lot of your videos specifically Clean Architecture one's, Really like you present them in separate videos. Just have one query you define project setup, Repository pattern, CQRS using clean architecture but is there a video where you call controllers / endpoints via Web projects ?
Thank you for great help, keep posting new videos :)
Try this video: ua-cam.com/video/nE2MjN54few/v-deo.html
@@MilanJovanovicTech Thanks Milan much appreciated for that video. How do you get the Carter is there nuget package also if possible can i access the Git Repo for this Crud example would like to view how to register services
Thank you
Good day, Milan. When should one consider using clean architecture? I suppose when project is really big and must be built with the aim to the future? It seems to me that for small projects it would be an overkill.
www.milanjovanovic.tech/blog/why-clean-architecture-is-great-for-complex-projects
Is it really a good practice directly use sql syntax when querying Webinar By Id, shouldn't it use the same approach as Creating Webinar through IWebinarRepository, and leave the implementation of WebinarRepository inside Infrastructure?
It's not "clean" in terms of Clean Architecture, but it's not wrong from a technical perspective.
@Milan this design keeps interfaces on domain layer and its implementations on infra right? When your application grows you infra layer will be end up in having tones of business implementations at that point does it really possible to change to any other persistence technology without major impact as the clean architecture promoting this as it's major benefit?
You can switch the implementation. Why would you place the business logic in the repository implementation though?
Good talk. Is there any github repo for the example that we can look at more in depth?
I share the code with my Patron supporters.
But you can also see a nice example on my GitHub.
@Milan Awesome. Very helpful for beginners like me who want to create a project setup based on clean architecture. But as a beginner, I have a question.
In the above example we find that for the interfaces, the infrastructure layer has the reference of the domain layer to access the repository interfaces for implementation. That means the infrastructure layer gets the reference of the domain layer. But in the clean architecture diagram, we find that the infrastructure layer should depend only on the application layer. But here to access the repository interfaces we need to add the reference of the domain layer inside the infrastructure layer. Is this the correct approach? Or we add the repository interfaces inside the application layer? Please clear my doubt.
Thank you,🙏
Outer layers can reference inner layers
@@MilanJovanovicTech If the outer layers can reference the inner layers, that means infrastructure and persistent layers also can access the domain layer ? Also I have a question, can we move the Interfaces folder from domain layer to application layer? As per my thinking, then infrastructure and persistent layer only depend on the application layer. Is this the correct way? Please help.
Thank you🙏
Hi Milan
I have a question ⁉️
Solution explorer has many known layers except docker.compose could u tell me how to create it and what it does !
Thanks
You can create it directly from Visual Studio with Add > "Container Orchestration Support"
Hi Milan.
Nice video as always.
I wonder why do you store the interfaces for the repositories in the Domain project, if they are only used in the Application project and the concrete classes reside in Infrastructure project ?
The same question for other parts of the Domain that are never referenced in the Domain project.
Thanks!
I consider repository interfaces part of the Domain, as they only work with Domain entities.
I see your point, but everything revolves around the Domain. It doesn't mean we put everything into the Domain.
@@andreibicu5592 These are just the interface definition. It's my view on how things should be done. Doesn't mean it's the only way.
suscribed! what about .net minimal api and clean architecture? great video by the way!
What about it, Luis?
What if database is responsible for generating Id for newly created resources? Do we completely remove the parent Entity class? How does it look in DD approach?
Just use it without a constructor that requires an Id
Hm, nice explanation of how you can make super simple project to look super complex
You'll make a better video, I'm sure of it
Hi Milan, this is great video! tahbk you!!, I just wondering if you have a git repo with this project?
You'll find some nice examples here: github.com/m-jovanovic
one question please Milan.
How do abstraction Layers affect performance as you said in Query Handlers?
It's not significant, I have a video about it coming out today.
Thanks boss, do you have videos of how you build the applications you do use for examples
please help a beginner
Check out the Clean Architecture playlist
@@MilanJovanovicTech ok thanks
Where would you put stuff for cross cutting concerns (common stuff). Like, say you have some helpful string extensions methods, where would these "helpers" go?
Depends on where you need them, I'd say
so if we draw the analogy to a MVVM project, could we say, that the Model is the Domain, the ViewModel is the application and the View is in the presentation layer, right?
And the Infrastructure would be stuff like internet services, themperaturedata from RS232, whatever and maybe also a Data Access Layer for File storage?
Why should we compare a design pattern to an architectural approach?
Hi@@MilanJovanovicTech, thanks for your perspective! I agree that it's not always straightforward to compare a design pattern like MVVM directly with an architectural approach like Robert C. Martin's CLEAN Architecture. However, my goal is to understand how the components of MVVM, which I've used in my code structured around CLEAN principles, map onto the different parts of CLEAN Architecture. I find the analogy helpful because both approaches essentially partition code responsibilities in a similar manner. It's really about leveraging the strengths of MVVM within the CLEAN framework to better organize my existing code.
Do you have any official documentation links available for MediatR and CQRS?
The MediatR documentation is a good place to start - other than that, I will be creating a video on that topic very soon.
There is any advantage (apart of code reuse) to split in projects instead of folders?
So you can split by functionality/module and then by every layer of Hexagonal architecture.
If you split in projects you can hide details with the internal keyword
@@MilanJovanovicTech So could be a good idea to create a project folder strcture like this?:
ModuleName.csproj -> Infrastrcturure (folder), application (folder) domain (folder)
Would be nice have source code available showed on the video ;) Thanks for the video. going to watch others
At the moment, the source code is only available to my Patreons.
But you can find some nice examples on my GitHub.
@@MilanJovanovicTech fair and square !
Milan, Is there any video discussing how to implement communication between bounded contexts?
Talked about sync communication here: ua-cam.com/video/hY342iy2PO0/v-deo.html
Hi Milan,
What would you say that are the main differences between Clean Architecture and Onion Architecture. Both look very similar to me. Is Onion Architecture a type of Clean Architecture?
Congrats about the video, you are helping me a lot in Brazil.
Hi Lucas, I'm glad you found the video useful!
To me, they're pretty much the same thing. I just preferred the CA as a better name :)
Where do you put the connectionstrings for ef core and how do you wire it up in Program.cs or StartUp.cs. From what I gather, The Web project will have to reference EF Core?. Somewhere you put builder.Services.AddDbContext(connectionString); Is this in Web or infrastructure as an extension method?
In the Web -> appsettings.json
@@MilanJovanovicTech Thanks for reply. In Web did you take a dependency on entity framework nuget?
When creating the UI/UX do you just implement the API endpoints from the Presentation layer to the UI/UX project?
Yes, usually I have a SPA consuming my API
Thanks for your reply, very much appreciated.
Does this mean that the API is in another solution/class library?
I thought the API should be nested in the presentation layer together with the SPA SomeProject.PresentationLayer
-API (web api)
-SPA (react.js)
@@alexanderm8169 The API is one project (solution) hosted in one repository.
The SPA is a separate application hosted in a different repository.
Nice video.
Can you please create a video on onion architecture.
It's identical to this one
Hey Milan, Presentation layer sounds like the it should be web or api layer which user would be accessing directly. So what's the difference between Presentation and Web projects in your system? May be I am missing something.
Just an idea to isolate your API endpoints if you want to. Otherwise it's not really necessary.
@@MilanJovanovicTech Great 👍
Thanks for the video
Personally I would not use this pattern on any project, since I find it to complicated, it introduces a significant overhead and it's just verbose.
The benefit compared to a more simple project structure is small. But thanks for the video anyways👍
That's fair 😁
Milan, do you have any good book to learn OOP with c#?
Let me take a look
Do you have any idea on how to solve Presentation Web relation with gRPC ? gRPC requires base class generation for services while the controllers are just a simple classes with annotations.
IMO, Web project is redundant because you can have multiple different presentation forms, instead I would suggest to work on developer discipline. :)
Going to have to research gRPC a little and get back to you, Miloš. I haven't really used it at all in practice, to be honest 🤷♂️