Get the source code for this video for FREE → the-dotnet-weekly.ck.page/ca-setup Want to master Clean Architecture? Go here: bit.ly/3PupkOJ Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt
@lukagolubovic3641
Жыл бұрын
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)
@MilanJovanovicTech
Жыл бұрын
@@lukagolubovic3641 4961, forgot to update the website. 5k before #014 goes out, hopefully 😁
@nikitalingyt4837
10 ай бұрын
Hello, I'm new to your channel. Do you have a project on Git that I could check out?
@NavedDeshmukh
2 жыл бұрын
The idea for separating the presentation layer from web is genius. Glad learned something new today. Thank you for sharing.
@MilanJovanovicTech
2 жыл бұрын
I'm glad you liked that idea 😁
@RoyZASTEROiD
Жыл бұрын
@@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
@runawayvon01
9 ай бұрын
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.
@MilanJovanovicTech
9 ай бұрын
You are crushing it, congrats! 🔥
@dddanielsr
7 ай бұрын
Can you share where and how did you apply?
@angelldark6426
Жыл бұрын
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.
@MilanJovanovicTech
Жыл бұрын
There's always more to learn, and that's a beautiful thing :)
@willgordon5737
19 күн бұрын
CONGRATS ON 100 K SUBSCRIBERS BROTHER
@MilanJovanovicTech
19 күн бұрын
Thank you so much 😀
@Felipe-ln1de
3 ай бұрын
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
@MilanJovanovicTech
3 ай бұрын
Glad you're enjoying it :)
@wvanlosser
2 жыл бұрын
Great video, I hadn't seen other examples of moving the controllers to a different project, learnt something new! :)
@MilanJovanovicTech
2 жыл бұрын
That's awesome, I'm glad you liked it!
@dennispitadeniya2479
3 ай бұрын
I'm new to clean architecture, and your video helped me to get the basics pretty quick.
@MilanJovanovicTech
3 ай бұрын
Glad I could help!
@MKayJay
Жыл бұрын
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 :-)
@MilanJovanovicTech
Жыл бұрын
A man of culture I see! 😁
@mohamed-hassan-
2 жыл бұрын
such an amazing simplified video, thanks a lot (from a junior perspective)
@MilanJovanovicTech
2 жыл бұрын
I'm glad you found it useful :)
@SysMess0
11 ай бұрын
Clean explanation for clean architecture, thank you milan for such a great video
@MilanJovanovicTech
11 ай бұрын
Glad you liked it!
@futurenerd2151
2 жыл бұрын
Using Repository and UoW abstraction, I love that approach because it gives some benefits
@MilanJovanovicTech
2 жыл бұрын
I agree, but some people seem to hate them 🤷♂️
@futurenerd2151
2 жыл бұрын
It's a never ending debate, but if it serves a purpose then we should use it. End of discussion 😃
@drm1983
2 жыл бұрын
Excellent tip on the controllers Assembly. Good stuff!
@MilanJovanovicTech
2 жыл бұрын
Thank you. It's unfortunate how unfamiliar people are with this.
@sushilb7994
2 жыл бұрын
Wow! I'm glad you started the KZitem 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!!!
@MilanJovanovicTech
2 жыл бұрын
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.
@timcesar1
2 жыл бұрын
Thanks, Milan looking forward to watching the whole series about this exciting topic
@MilanJovanovicTech
2 жыл бұрын
Thank you Cesar! More exciting videos are on the way 😁
@danimydev
2 жыл бұрын
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!
@MilanJovanovicTech
2 жыл бұрын
Thanks a lot, Daniel!
@trxe420
2 жыл бұрын
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.
@MilanJovanovicTech
2 жыл бұрын
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.
@trxe420
2 жыл бұрын
@@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.
@fernandocalmet
2 жыл бұрын
Very grateful for your content, the best successes Milan😁
@MilanJovanovicTech
2 жыл бұрын
Thank you very much, Fernando!
@codewithguillaume
2 жыл бұрын
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 !
@MilanJovanovicTech
2 жыл бұрын
Why do you find it difficult? What part is the most problematic?
@waverider995
2 жыл бұрын
Awesome video! Can't wait for more videos about Clean Architecture!
@MilanJovanovicTech
2 жыл бұрын
Thanks a lot Nikola!
@hamitkarahan2973
2 жыл бұрын
Congrats Milan! I believe we have many things to learn from you. Keep going ✌💪
@MilanJovanovicTech
2 жыл бұрын
Thank you 🙌
@adriano.digiere
2 жыл бұрын
Great video Milan! Thank you so much for sharing.
@MilanJovanovicTech
2 жыл бұрын
Thanks, I'm really happy you liked it. What was your biggest takeaway from this one?
@adriano.digiere
2 жыл бұрын
@@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.
@milosmaljenovic4670
2 жыл бұрын
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 :)
@MilanJovanovicTech
2 жыл бұрын
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. 😁
@milosmaljenovic4670
2 жыл бұрын
@@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
@swiftybathero
2 жыл бұрын
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 : )
@MilanJovanovicTech
2 жыл бұрын
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.
@ucheemmanuel9797
Жыл бұрын
How can I reach you? Would love to learn
@offthepathworks9171
Жыл бұрын
Brilliant discussion, thanks to both.
@jakkepiet
Жыл бұрын
@@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
@danfriedman7009
Жыл бұрын
@@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.
@pedroalexandre157
2 жыл бұрын
Great video quality! I'm sure your channel will grow exponentially, it's just a matter of time! Keep up the good work!
@MilanJovanovicTech
2 жыл бұрын
Thanks a lot Pedro!
@subashbarik
2 жыл бұрын
Great video , please keep posting videos like this.
@MilanJovanovicTech
2 жыл бұрын
Next video is coming out today - how to add DDD to the Clean Architecture
@SuperSayiyajin
2 жыл бұрын
Thanks...We wait for next videos.
@MilanJovanovicTech
2 жыл бұрын
Coming out on Tuesday!
@impressias975
2 жыл бұрын
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
@MilanJovanovicTech
2 жыл бұрын
Awesome. But who's Chris? 😁
@rhiguera75
2 жыл бұрын
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!!!!
@MilanJovanovicTech
2 жыл бұрын
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.
@rhiguera75
2 жыл бұрын
Modular Monolith. rocks!!!!
@omerkulahli3865
2 жыл бұрын
Great video! Thank you for sharing with us.
@MilanJovanovicTech
2 жыл бұрын
You're more than welcome 😊
@petewarner1077
2 жыл бұрын
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!
@MilanJovanovicTech
2 жыл бұрын
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.
@petewarner1077
2 жыл бұрын
@@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?
@MilanJovanovicTech
2 жыл бұрын
@@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. 🤔
@cansozbir
Жыл бұрын
@@MilanJovanovicTech I wonder what do you think about this topic today Milan :)
@oimarrom
2 жыл бұрын
Tks for vídeo ! Hug from Brazil
@MilanJovanovicTech
2 жыл бұрын
Thanks Ramon!
@saddamhossaindotnet
2 жыл бұрын
Well done Milan! Congrats for your second video!
@MilanJovanovicTech
2 жыл бұрын
Thanks Saddam, hope you liked it!
@ryanalexander5438
2 жыл бұрын
Awesome work Milan!
@MilanJovanovicTech
2 жыл бұрын
Thank you so much for the support Ryan!
@mozamilahmadafghan4889
Жыл бұрын
Thanks for this video, that helped me alot.
@MilanJovanovicTech
Жыл бұрын
Awesome, I'm glad to hear that :)
@stunna4498
2 жыл бұрын
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.
@MilanJovanovicTech
2 жыл бұрын
Of course, that's a great way to implement the Clean Architecture 😁
@darrenadams783
Жыл бұрын
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.
@lucasluizss
2 жыл бұрын
Well done Milan! Congrats 👏🏽👏🏽👏🏽
@MilanJovanovicTech
2 жыл бұрын
Thanks Lucas!
@FreakyDev16
2 жыл бұрын
Great video!!! Thanks for sharing.
@MilanJovanovicTech
2 жыл бұрын
You're welcome!
@FreakyDev16
Жыл бұрын
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.
@MilanJovanovicTech
Жыл бұрын
Send me an email
@willemmeints3123
Жыл бұрын
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.
@MilanJovanovicTech
Жыл бұрын
I never worked with ES so not sure if that makes sense or not 🤔
@sudhirpatil8217
2 жыл бұрын
This introduction part is great. KUDOS TO YOU... Where is the next video for implementation part ???
@MilanJovanovicTech
2 жыл бұрын
Check out this playlist: kzitem.info/door/PLYpjLpq5ZDGstQ5afRz-34o_0dexr1RGa
@sudhirpatil8217
2 жыл бұрын
@@MilanJovanovicTech yes I am going thr that immediately after this video.... G8 content
@vijaysaini83
Жыл бұрын
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.
@MilanJovanovicTech
Жыл бұрын
That's fair! I'll work on that in the future :)
@yevheniimolodtsov9510
Жыл бұрын
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
@balajisairamnarasimhan
Жыл бұрын
Thanks for posting this video and making this clear architecture more precise. Can you pls mention the benefits of using these pattern versus others ?
@MilanJovanovicTech
Жыл бұрын
Will cover in some future videos :)
@VijayNirmal
Жыл бұрын
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?
@MilanJovanovicTech
Жыл бұрын
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
@fieryscorpion
2 жыл бұрын
Great video! Can you please please show how to setup Serilog logging in this project structure throughout all the projects?
@MilanJovanovicTech
2 жыл бұрын
Sure thing, I can cover that in some future video :)
@alexmadnix
Жыл бұрын
Respect my bro
@MilanJovanovicTech
Жыл бұрын
Thank you!
@alexmbr
11 ай бұрын
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.
@MilanJovanovicTech
11 ай бұрын
You'd still need to reference Infrastructure from the Api and the same problem happens
@sys-zr8ve
8 ай бұрын
Hello Milan, I enjoy watching and learning from your educational videos! :) Would be very nice with a Github repository for each video. Pozdrav
@MilanJovanovicTech
8 ай бұрын
Check the pinned comment :)
@HM_Milan
Жыл бұрын
Thank you
@MilanJovanovicTech
Жыл бұрын
Any time :)
@rossimac
Жыл бұрын
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.
@MilanJovanovicTech
Жыл бұрын
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.
@rossimac
Жыл бұрын
@@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.
@jeraxsanchez
2 жыл бұрын
New subscriber here. Thank you
@MilanJovanovicTech
2 жыл бұрын
Awesome Jerald, thank you!
@ealeykin
4 ай бұрын
Hm, nice explanation of how you can make super simple project to look super complex
@MilanJovanovicTech
4 ай бұрын
You'll make a better video, I'm sure of it
@shashankpandey1019
2 жыл бұрын
Great video 👍 thankyou
@MilanJovanovicTech
2 жыл бұрын
You're welcome! 😊
@jaydeeppatil9120
Жыл бұрын
Great Job
@MilanJovanovicTech
Жыл бұрын
Thanks!
@branislavpetrovic7486
2 жыл бұрын
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!
@MilanJovanovicTech
2 жыл бұрын
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.
@branislavpetrovic7486
2 жыл бұрын
@@MilanJovanovicTechThanks for nice clarifications. Keep going with nice work.
@phanuwatwattanapraya7998
2 жыл бұрын
Great video
@MilanJovanovicTech
2 жыл бұрын
Thank you!
@meysamhadeli
2 жыл бұрын
Thanks for video :) Milan, why do you use repository and unit of work? EF has built-in feature for unit of work. I think using repository and unit of work on top of EF core is antipattern, maybe is better we inject our DB Context directly in our CQRS level.
@MilanJovanovicTech
2 жыл бұрын
1. I don't like having a direct dependency on EF in my Application layer 2. I don't think it's an anti-pattern since I can get several benefits 2.1. I can load aggregates from one repository call, and use that method everywhere. If I updated the query for fetching the aggregate, I only have to do it in one place. 3. Testing/mocking EF is a hassle. But with repository/UoW abstractions testing is straightforward.
@DevJonathanRamos
2 жыл бұрын
@Meysam I have a layer of services that make use of the dbcontext and these services are consumed by multiple queries/commands
@clashclan4739
2 жыл бұрын
Finally found someone with same mindset 🙌
@ninalamo275
2 жыл бұрын
I used to think the same until I had to use Dapper -- that's one scenario wherein you need to remove dependency from EF.
@jpocketvnext
Жыл бұрын
Regardless of EF Core’s intrinsic UOW functionality, its API (designed to handle virtually any scenario) is WAY to broad. Encapsulating the DB context and injecting it into focused domain CQRS handlers is very powerful. Doing so is overkill for simple systems, but for complex domains and applications its the only way I roll.
@jakkepiet
Жыл бұрын
if you make the infra layer internal, you do not need the extra presentation layer for the controllers
@MilanJovanovicTech
Жыл бұрын
Just a preference of mine 🤷♂️
@adeni4359
2 жыл бұрын
Subscribed! Please post more videos, like Web Api
@MilanJovanovicTech
2 жыл бұрын
Heard you loud and clear, more videos on Web APIs incoming!
@LeonardoGSena
7 ай бұрын
Absolutely amazing! I'm wondering what theme you're using... could you share? Tks!
@MilanJovanovicTech
7 ай бұрын
It's ReSharper
@shabbir200
Жыл бұрын
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 :)
@MilanJovanovicTech
Жыл бұрын
Try this video: kzitem.info/news/bejne/z3tos56EbmaXmKw
@shabbir200
Жыл бұрын
@@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
@elpe21
Жыл бұрын
Would be nice have source code available showed on the video ;) Thanks for the video. going to watch others
@MilanJovanovicTech
Жыл бұрын
At the moment, the source code is only available to my Patreons. But you can find some nice examples on my GitHub.
@elpe21
Жыл бұрын
@@MilanJovanovicTech fair and square !
@gremlinx7819
2 жыл бұрын
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
@MilanJovanovicTech
2 жыл бұрын
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.
@helloworld9018
5 ай бұрын
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.
I have seen many project setups to have a Domain layer like you have, but also a Domain.Shared where shared items reside. Wondering why you don't have this project and do you think it is a good idea to have a Domain.Shared project?
@MilanJovanovicTech
Жыл бұрын
That makes sense if you have what to share it with, but this example project is too small
@dallyoluwafemi2827
Жыл бұрын
Thanks boss, do you have videos of how you build the applications you do use for examples please help a beginner
@MilanJovanovicTech
Жыл бұрын
Check out the Clean Architecture playlist
@dallyoluwafemi2827
Жыл бұрын
@@MilanJovanovicTech ok thanks
@milicabozic3827
2 жыл бұрын
Interesting topic 🙌
@MilanJovanovicTech
2 жыл бұрын
Indeed Mika!
@MrAymenmatador
2 жыл бұрын
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 ?
@MilanJovanovicTech
2 жыл бұрын
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.
@maroquio
2 жыл бұрын
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?
@MilanJovanovicTech
2 жыл бұрын
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. 😁
@ricomarcelo5521
2 жыл бұрын
thanks! subbed.
@MilanJovanovicTech
2 жыл бұрын
Welcome to the community! 😁
@microcareacademy
Жыл бұрын
Hi Milan, Application Project -> Modules -> Feature1 -> Commands -> Queries -> Interfaces -> Services For every feature(folder), I am adding 4 folders Can u give any advice here ?
@MilanJovanovicTech
Жыл бұрын
If you're already grouping by features, why group by type in the actual feature folder?
@microcareacademy
Жыл бұрын
@@MilanJovanovicTech, U mean, why group Commands, Queries, Interfaces, and Services inside each feature? Inside each feature, I can have multiple commands/queries/Interface/Services Command -> UserProfileAddHandler -> UserProfileDeleteHandler Queries -> GetUserProfileById Finally, Module 1 -> Feature 1 -> Commands -> Queries -> Interfaces -> Business Services
@amarul92
Жыл бұрын
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?
@MilanJovanovicTech
Жыл бұрын
In the Web -> appsettings.json
@amarul92
Жыл бұрын
@@MilanJovanovicTech Thanks for reply. In Web did you take a dependency on entity framework nuget?
@warrenbuckley3267
Жыл бұрын
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?
@MilanJovanovicTech
Жыл бұрын
Depends on where you need them, I'd say
@vertikalniserklaz8694
3 ай бұрын
Milan, Is there any video discussing how to implement communication between bounded contexts?
@MilanJovanovicTech
3 ай бұрын
Talked about sync communication here: kzitem.info/news/bejne/yY9pmmafsmSBgmU
@jchandra74
Жыл бұрын
Good talk. Is there any github repo for the example that we can look at more in depth?
@MilanJovanovicTech
Жыл бұрын
I share the code with my Patron supporters. But you can also see a nice example on my GitHub.
@Kumar-oz5wr
Жыл бұрын
Nice video. Can you please create a video on onion architecture.
@MilanJovanovicTech
Жыл бұрын
It's identical to this one
@natiwl
Жыл бұрын
Nice simplified Video, Just a question, why did you use parameterless constructor in Webinar class?
@MilanJovanovicTech
Жыл бұрын
For EF Core, so that it can initialize the entity when querying
@alejandrovelascoaranda6721
2 жыл бұрын
Hi Milan! Firstly, Congrats on the video! I would ask you something! 1) Why are you using Dapper within the application layer? I understand that it is for improving the performance, but it's creating a dependency on dapper? Should you encapsulate dapper on a new repository in the infrastructure layer? 2) Can we use the service domain to encapsulate the repository behavior? And we'll call directly to service instead of the repository from CommandHandler Thanks! and keep sharing your knowledge!
@MilanJovanovicTech
2 жыл бұрын
1. I don't think Dapper is a true "dependency" since I'm just writing SQL. But I agree that we can easily extract it outside of the application layer to keep it clean. 2. Not sure what you meant here exactly. Could you elaborate? Would love to discuss.
@alwaseem5309
Жыл бұрын
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?
@MilanJovanovicTech
Жыл бұрын
Repo/service approach will be your best bet
@msayeed78
Жыл бұрын
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.
@MilanJovanovicTech
Жыл бұрын
Call it from a service, or call it directly
@Zisane21
6 ай бұрын
I may have missed this but what layer should Errors\Result be part of? In another video saw you used a SahredKernel project
@MilanJovanovicTech
6 ай бұрын
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.
@karthikeyanR87
Жыл бұрын
I also followed your guideline and separated the Controller to new .net6.0 core class library I face two issues First I tries to add nuget package AspNetCore.Mvc which deprecated so changed Project file to and i am getting error "Program does not contain a static 'Main' method suitable for an entry point" I controller class library i added startup.cs file and added only one line "var builder = WebApplication.CreateBuilder(args);" everything works fine is this is right way. public static IServiceCollection AddPresentation(this IServiceCollection services) return service and in main web Api builder.Services.AddPresentation(); builder.Services.AddControllers().AddApplicationPart(typeof(AssembleyRefernece).Assembly); is also not working.
@MilanJovanovicTech
Жыл бұрын
Will have to get back to you on this one
@rammehar5531
Ай бұрын
Thanks for this wonderful explanation, I have a question: In the context of an e-commerce system, there are typically two key entities: User (which includes attributes like name, email, password, etc.) and Customer (which includes attributes like name, email, addresses, etc.). Could you explain the relationship between these two entities? How do they interact within different bounded contexts? Additionally, a User in this system could take on various roles, such as a buyer, supplier, member, or even a blogger. When a User registers on the app, are both the User and Customer entities created simultaneously, or is there a different approach to managing these entities? Could you walk through the proper design pattern or model for handling this scenario?
@MilanJovanovicTech
Ай бұрын
They can be the same entity. They can even share the same database table.
@rammehar5531
Ай бұрын
@@MilanJovanovicTech it means there is only one entity either User Or Customer
@maxaigner5322
9 ай бұрын
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?
@MilanJovanovicTech
9 ай бұрын
Why should we compare a design pattern to an architectural approach?
@maxaigner5322
9 ай бұрын
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.
@ertugrulkayabas7157
2 жыл бұрын
I lke it :) Thank you
@MilanJovanovicTech
2 жыл бұрын
Awesome! There's a whole series of videos on this topic coming
@dxs1971
2 жыл бұрын
There are a lot of great videos where we do not throw exceptions but simple return Maybe or Maybe so you can control your application by examine that object. Also using of repositories and unit of work is obsolete by now, since EF itself already has this two inside. So you are duplicating what Microsoft already did.
@MilanJovanovicTech
2 жыл бұрын
That's a fair point. I will expand on this idea in a future video. I personally prefer nullable reference types to Maybe.
@MilanJovanovicTech
2 жыл бұрын
Also, the about Repository and UoW. Just show me how you write unit tests for EF in you Application layer.
@dxs1971
2 жыл бұрын
@@MilanJovanovicTech Using inmemmory EF, easy
@dxs1971
2 жыл бұрын
OR {We should use interface IDbContextFactory which is use to provide DbContext, just my two cents.}
@MilanJovanovicTech
2 жыл бұрын
@@dxs1971 You are defeating the whole purpose of "Clean" Architecture by poluting the Application layer with EF
@osamadammag6303
Жыл бұрын
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
@MilanJovanovicTech
Жыл бұрын
You can create it directly from Visual Studio with Add > "Container Orchestration Support"
@microtech2448
8 ай бұрын
Hello, well I found this today exactly on code-maze as well. I have query on presentation layer. You are still using all project references in the presentation project and controller can still use dbcontext which I think you can remove project reference of infrastructure from presentation easily but how would you prevent domain being referenced if using CQRS in Application layer and you need its reference for sure. 2. In Web project, as you have to register all dependencies including infrastructure, how would you prevent calling dbcontext if you use minimal api in web?
@MilanJovanovicTech
8 ай бұрын
1) Don't worry about project references. Worry about educating your team how to respect the design. Architecture tests can also help. 2) Code review? :)
@microtech2448
8 ай бұрын
I don't want to review anything but interested into reason separate presentation layer was created but with minimal api in web we can lose the purpose of separate presentation layer .
@mohammadmz1058
Жыл бұрын
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👍
@MilanJovanovicTech
Жыл бұрын
That's fair 😁
@vm7738
Жыл бұрын
Thank you!
@MilanJovanovicTech
Жыл бұрын
You're welcome!
@Embriiii
Жыл бұрын
Considering that the read model can evolve independently then the domain model, it could be true that in the read model i'll aggregate information of different contexts, if you agree with this consideration, the solution structure, where the context it's the root, should be a problem. how would you solve it?
@MilanJovanovicTech
Жыл бұрын
I didn't really understand your question
@Embriiii
Жыл бұрын
@@MilanJovanovicTech Usually the structure of solution, when we talk about Clean Architecture, is structured using Projects, that are the layers, with folders, that are the bounded contexts: in this case Application and Webinars. Inside Webinars there are two folders that represent principles about CQRS: Command and Queries. I have no doubt about Command that it's correct of course, but i'm not sure about Queries because the read model could not be restricted to one bounded context, it could be an aggregation of information about different contexts, and, in this case, i'm not sure where to place it. Another b. context with only the query side of CQRS? Extract to Application level this case outside a b.context?
@Cursix
2 жыл бұрын
Good video
@MilanJovanovicTech
2 жыл бұрын
Thank you!
@LucasSantos-yw4nh
2 жыл бұрын
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.
@MilanJovanovicTech
2 жыл бұрын
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 :)
@DasDreaD666
2 жыл бұрын
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?
@MilanJovanovicTech
2 жыл бұрын
Just use it without a constructor that requires an Id
@davorzganjer5291
6 ай бұрын
06:39 is a query handler that acts as a repository to fetch the data as a part of Application services but later in video 8:00 you pointed out that the infrastructure layer would hold an implementation to fetch the data from DB which makes me confused.
@MilanJovanovicTech
6 ай бұрын
Check out some other CA videos I released
@SoheilKhosroshahi
7 ай бұрын
where is the right place for checking the business rules and validating request data in this architecture ?
@MilanJovanovicTech
7 ай бұрын
Request validation as high as possible Business rules in the use case
@mostafachronic1874
12 күн бұрын
Milan and dear teacher, could you please teach me how to implement multilingual functionality in the system?
@MilanJovanovicTech
11 күн бұрын
Will see
@vinr
2 жыл бұрын
I don't understand why do you have SQL statement (ideally we could have nosql db plugged in as well) inside the Core.Application, shouldn't it be just an interface there to find the webinar by giving the Id instead of assuming the persistent layer supports SQL?
@MilanJovanovicTech
2 жыл бұрын
A SQL statement does mean we have a SQL database underneath, indeed. I left it like that for simplicity. I do agree that wrapping that inside a service would be a better approach.
@KonradGM
Жыл бұрын
Hi as new subscriber and lerning .NEt dev, i assume this tutorial is for .NEt not .Net core, will wee see something simmiliar for .Net core?
@MilanJovanovicTech
Жыл бұрын
This is .NET Core 6, and all new content is .NET 7
@MessiNedved
Жыл бұрын
Why Repository interface and unit of work interface was located in Domain project , I think it is more suitable in Application project
@MilanJovanovicTech
Жыл бұрын
In my opinion, it's fine to put them there as long as I don't leak any external dependencies (and I don't, it's just an interface)
Пікірлер: 440