Clean Architecture Project Setup From Scratch With .NET 7

  Рет қаралды 134,209

Milan Jovanović

Milan Jovanović

Күн бұрын

Пікірлер: 287
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Get the source code for this video for FREE → the-dotnet-weekly.ck.page/ca-from-scratch Want to master Clean Architecture? Go here: bit.ly/3PupkOJ Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt
@camping29
@camping29 Жыл бұрын
@milan, is this included in your clean architecture course? I got your course but do I need to study this separately ?
@redachouiba4862
@redachouiba4862 Жыл бұрын
Do you have any example plz ?
@marna_li
@marna_li Жыл бұрын
Thanks for the video! It is important for beginners to know that once you get a hold of separating stuff you can adapt this structure to your case. Merge and rearrange. Even create your own modules and so. In my case I moved more towards a VSA and put controllers together with application code. As long as you clearly keep stuff logically separate it is OK.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Being pragmatic about architecture is something that comes with experience :)
@marna_li
@marna_li Жыл бұрын
@@MilanJovanovicTech Yes. 🙂
@PROFDAILY
@PROFDAILY Жыл бұрын
@@MilanJovanovicTech i would also like to see that
@andrewholloway-breward213
@andrewholloway-breward213 Жыл бұрын
Hi Milan, thanks for this insight into the basic project setup which has been born out of experience. Just embarking on a new project and I am adopting DDD, CQRS and MediatR as having worked on a legacy project for the past 10 years I can see the benefits of this approach and I look forward to future videos!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thanks a lot Andrew. I have a bunch of older videos also talking about these topics.
@joseantonioteransuarez6840
@joseantonioteransuarez6840 Жыл бұрын
To fully understand, could you do a CRUD for a single entity? So the communication between layers could be seen better 🙏
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Started something like that, watch the next video
@kisan.choudhari
@kisan.choudhari Жыл бұрын
​@@MilanJovanovicTech I am waiting for this.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
kzbin.info/www/bejne/pHaVfp2EapmZm9k
@justtomi-qp8qj
@justtomi-qp8qj Жыл бұрын
Thanks for sharing! There are some details that I would like to understand there... - As why do you have separate WebApi and Presentation layer? - Why is Application layer separate from Domain layer? Keep making great stuff!
@pilotboba
@pilotboba Жыл бұрын
In theory, domain can be shared by many applications [because It depends on nothing] But, if that's not the case, create a Core project and put both your entities and your use cases in it. :)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
1. It's a personal preference of mine. Separating the executable (WebApi) from the endpoints/controllers 2. You want to isolate the core domain, so that it's not polluted by external concerns
@justtomi-qp8qj
@justtomi-qp8qj Жыл бұрын
@@MilanJovanovicTech hmm isn't application layer as well your core domain (logic). By doing that you're somehow breaking YAGNI with the assumption that your domain will have different applications. Thanks for clarification!
@pilotboba
@pilotboba Жыл бұрын
@@MilanJovanovicTech So what code actually ends up in your Api project? Just the startup class?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
@@pilotboba Pretty much yeah, just an entry point. Maybe some middleware? But those can also live elsewhere.
@gianlucalocri
@gianlucalocri Жыл бұрын
Very nice as always!!! But I didn't get the point on presentation project. What is supposed to go in there?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Separating the executable from the endpoints. So controllers, minimal Apis, view models.
@DenisioRodrigues
@DenisioRodrigues 9 ай бұрын
This video is the best video when to talk in start configure you application with clean architecture.
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
Thanks!
@manofqwerty
@manofqwerty Жыл бұрын
Great video, I am trying to convince work to convert one of our solutions to implement the CLEAN architecture and this video has helped me focus my thoughts.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad it was helpful!
@vitek0585
@vitek0585 Жыл бұрын
This is great for someone who is just starting interested in clean architecture 👍
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I'll try to make some more beginner friendly content :)
@jaymarkestrera3691
@jaymarkestrera3691 Жыл бұрын
I'm really glad I found this channel. I was struggling to find these kind of videos before especially about DDD.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
More DDD videos next week 😁
@jaymarkestrera3691
@jaymarkestrera3691 Жыл бұрын
@@MilanJovanovicTech That's great!
@jamesevans6438
@jamesevans6438 Жыл бұрын
Hey Milan, Great video and congrats on the MVP, you have been smashing it and are awesome!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Hey, thanks!! 😊
@rafekemmis3097
@rafekemmis3097 Жыл бұрын
As a solutions architect, how do you document your architecture design so devs can understand and follow it?
@sivumakhonco
@sivumakhonco Жыл бұрын
I would imagine the decision to use a clean architecture or other alternative is a decision for the development team. Surely the solution architecture shouldn't be so prescriptive as to dictate implementation detail like how to organise source code?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Solution architecture is one level above this, so it would be just a component. C1/C2 diagram perhaps, check it out. For something lower level than that, you can do C3/C4.
@rokatainment
@rokatainment Жыл бұрын
I usually document using the arc42 template in a markdown format alongside with my code. This way it's always versioned, too.
@caseyspaulding
@caseyspaulding Жыл бұрын
Thanks. Best explanation I have found. Simple to the point
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I think you'll enjoy my Clean Architecture course, it's coming out soon
@BandieraRossa87
@BandieraRossa87 Жыл бұрын
Two things I didn't understand so far: 1. What's the purpose of having a "Presentation" project additionally to the "WebApi" project? So far, I was used to have only the WebApi project. What would you put into the Presentation project? 2. Why did you add Serilog.AspNetCore to the WebApi project and not to the Infrastructure Project? Isn't logging an infrastructure-related topic?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
1. Move the API endpoints/controllers into that project, along with any view models. More of a personal preference than a real necessity. 2. Ah, good point! I find it easier to leave Serilog registration there because of the tight ASP.NET Core coupling (registering on the HostBuilder). Of course, we can move all of the registration into AddInfrastructure. Now that I think of it, it makes perfect sense. Thanks for calling me out on that 😁
@RonyCuzco
@RonyCuzco Жыл бұрын
@@MilanJovanovicTech could you provide an example of that approach? Sounds interesting.
@scottprokopetz7098
@scottprokopetz7098 Жыл бұрын
@@MilanJovanovicTech Can you show how you would move the Serilog registration into the AddInfrastructure?
@nove1398
@nove1398 Жыл бұрын
+1 for blank solution
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I might be onto something
@cansozbir
@cansozbir Жыл бұрын
Oh man :) Yesterday I've created a CQRS + Clean architecture web API. I went back and forth on your videos to structure the project :) I wish I had waited one more day :)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Ah, you never know 🤣
@stephen9646
@stephen9646 Жыл бұрын
Hi Milan, I've just started learning about clean architecture and I would like to clarify if the Domain layer is similar with Model classes?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Not really, it's a broader concept
@ToPFeE1234
@ToPFeE1234 Жыл бұрын
Good explanation! Can't wait to see another architecture 😊
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
VSA coming
@jamesevans6438
@jamesevans6438 Жыл бұрын
@@MilanJovanovicTechGood choice!
@abdifatahAnnaati
@abdifatahAnnaati Жыл бұрын
Clean architectur subjective, so it's different for a lot of people. Personally Mine is as Fellows(Folder structures) Sol-Folder Entities Services DTO(AddReq/EditReq/Res for each Entity plus some custom ViewModels) Interfaces Helpers actual Services..... Main Project areas(if req)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Agreed, find what works for you
@MohammadMahdiNiknam
@MohammadMahdiNiknam 11 ай бұрын
Hi thanks for the video Should I use this practice for .NET 8? Or now it's different with .NET 8?
@MilanJovanovicTech
@MilanJovanovicTech 11 ай бұрын
It's fine in any .NET version :)
@MohammadMahdiNiknam
@MohammadMahdiNiknam 11 ай бұрын
@@MilanJovanovicTech Thanks again. I'm a junior developer and your videos are the best content that I saw for learning DDD and Clean Architecture.😘😘😘
@prasadmadushan
@prasadmadushan Жыл бұрын
thank you explaining things with diagrams. very clean
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
You are welcome!
@Georgii1212
@Georgii1212 Жыл бұрын
Thanks for the video. In some tutorials, there is no Presentation layer. And the REST Controllers, for example, are in the Application layer instead of Presentation layer. Do you have any thoughts on that, is this also valid ?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Both approaches are valid, imo. Depends on how much control you want to have over the Controllers and what they can access. One example where it makes sense to separate the endpoints is when building a Modular monolith.
@artemvolsh387
@artemvolsh387 Жыл бұрын
Love video, and channel as well. Find it very useful and educative. Thanks a lot!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thank you for watching! 😊
@ChristianAltamiranoAyala
@ChristianAltamiranoAyala 10 ай бұрын
Great video Milan, my only concern is why you separate the presentation layer into two projects, what's the benefit you obtain by doing that?
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Didn't I explain that in the video? 🤔
@ChristianAltamiranoAyala
@ChristianAltamiranoAyala 10 ай бұрын
No, You just mentioned that we have two options on how to structure the presentation layer, but didn't mention the benefits of separating the presentation into two projects. 😔
@thomascv321
@thomascv321 Жыл бұрын
Someone has been reading Eric Evans and Robert C. Martin! :D Great video Milan!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I've been influenced by them a lot, for better or worse
@alexmadnix
@alexmadnix Жыл бұрын
Thanks for sharing! Ace Milan Jovanović
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad you liked this one 😁
@user-rp9iis1en6h
@user-rp9iis1en6h Жыл бұрын
Great one. Could you please extend this video and show us one step further such as how we can add a helloworld endpoint that will fetch data from db and return json response. Basically we wanted to learn where to plant view models, where to put services, where to put repository and make it workable.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Take a look at the few videos after that
@saididbesslam7607
@saididbesslam7607 Жыл бұрын
Hi Milan, thanks for the video! I have just one question though, why didn't you reference application project in infrastructure project? (PS: I am new with clean architecture concepts)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Just missed to show it in the video, but you will need to have a reference regardless
@bismarckmartinez1545
@bismarckmartinez1545 Жыл бұрын
Nice video my dear Milan Jovanovic! ;D Congrats!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thank you very much!
@alpsavasdev
@alpsavasdev Жыл бұрын
I think splitting the infrastructure layer to multiple projects for each infrastructural concern (database, email gateway, other external apis) looks more maintainable. I did that in a few projects and helped me better organize and understand my codebase (inspiring from the "screaming architecture")
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
You can make it as granular as you want, or not granular at all
@alpsavasdev
@alpsavasdev Жыл бұрын
@@MilanJovanovicTech IMHO “horizontal” granularity is not a problem at all, compared to vertical layering which causes a lot of indirection.
@PROFDAILY
@PROFDAILY Жыл бұрын
enjoying the content, subscribed already
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Happy to have you :)
@goldenhits2645
@goldenhits2645 Жыл бұрын
Hi ,Milan, Have you done any crude operations on this architecture ?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Video coming out today 1PM with CRUD API basics!
@jerryjeremy4038
@jerryjeremy4038 6 ай бұрын
I like this better than the vertical approach.
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Why so?
@opg21243
@opg21243 Жыл бұрын
Great video, I guess for the unit tests, it will be in another project right? in this case, a unit test project? what references from the other projects should have this unit test?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Unit test can reference all the other projects, not a big problem
@wellyngtond2
@wellyngtond2 Жыл бұрын
Hello, good video. At which layer would you place a payment API interface and implementation?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Application/Infrastructure
@blazorSQL
@blazorSQL 8 ай бұрын
Thank you for this educational video that you sent. Do you have an example of a website or a small project that can be implemented and that I can understand the concept of this method and standard for me to check, or have you made a training video on this matter so far? Thank you.
@MilanJovanovicTech
@MilanJovanovicTech 7 ай бұрын
I have a course showing how to implement Clean Architecture on a practical project
@blazorSQL
@blazorSQL 7 ай бұрын
@@MilanJovanovicTechWould you please send me the link of that video? Any help is appreciated.
@nt2548
@nt2548 10 ай бұрын
Thank you for your video. Best explanation I've found. I have a question. Is it correct to the WebAPI layer know about Infrastructure Layer? Some diagrams in the internet show that Application and Domain Layers only work with Infrastructure layer
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Yes, that's fine
@mortensnetoftwernberg8784
@mortensnetoftwernberg8784 4 ай бұрын
Hi Milan. Good stuff. Doesn't the Presentation layer project need to be AspNetCore as well? Or how to add controllers to a class library?
@MilanJovanovicTech
@MilanJovanovicTech 4 ай бұрын
You can add the framework reference and it'll be enough
@CarlosWashingtonMercado
@CarlosWashingtonMercado Жыл бұрын
You (may) forgot to make the cursor visible. Great video. I'm subscribing.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thanks! I'm working on Pragmatic Clean Architecture course right, which you might also enjoy :)
@CarlosWashingtonMercado
@CarlosWashingtonMercado Жыл бұрын
@@MilanJovanovicTech good news. I’ll be looking forward to it!
@destroyer1233
@destroyer1233 8 ай бұрын
Great Video! Can you record the insertion of the frontend (.cshtml) in the clean architecture template?
@MilanJovanovicTech
@MilanJovanovicTech 8 ай бұрын
Maybe. I've been reluctant to touch MVC
@nanvlad
@nanvlad Жыл бұрын
As I understand Prestentation project is a bridge to Application -> Domain and can consist of ViewModels/Models for WeApi/Razor Pages projects? At the same time there is a separate path from Api to Infrastructure -> Persistence which do not interfere with Application/Domain projects.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Yes, you get it 😁
@simonhamelech
@simonhamelech Жыл бұрын
Thanks for sharing. I would love to see how you fill out all the layers in a demo app.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I'll try to make it happen, layer by layer
@Bilalkhan-pf8xg
@Bilalkhan-pf8xg Ай бұрын
Hey Milan I like your work.. thanks for sharing your valuable experience with us.. i have a simple question for you could you please explain a bit why you put separate class lib presentation project either you can add your controller on you webApi project that you added at the end...its confusing what to do with presentation layer then.. thanks your answer will be appreciated
@MilanJovanovicTech
@MilanJovanovicTech Ай бұрын
I think I explained it in some video already
@mohaarulez
@mohaarulez Жыл бұрын
Love these kind of video's. Thank you for the effort!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Awesome, glad you liked it!
@mylesdavies9476
@mylesdavies9476 Жыл бұрын
Nice video, thanks. Still eagerly awaiting your video on setting up a modular monolith with module registration. Perhaps you could use this video as a starting point by showing how to register two CA projects?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I think yes, this video will be a starting point, to a more complete series about CA. And then I plan to evolve it into Modular Monolith. But honestly, Modular Monolith is such a complex topic that it would probably be better off creating a detailed course about it (4-5 hours) and just explaining absolutely everything.
@enricoroselino7557
@enricoroselino7557 10 ай бұрын
finally i land on the noob section please guide me into clean architecture. The Clean architecture and DDD series need to start from this vid😆 btw my VS not auto adding the using statemet :/ how do you do that ?
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Check out my Clean Architecture playlist
@subhrajitmazumder7122
@subhrajitmazumder7122 Жыл бұрын
@MilanJovanovicTech Thanks for giving us this wonderful video. Also I have a question, when I go to register the "AddPresentation()" or "AddInfrastructure()" or "AddApplication()" inside the program.cs file, it gives me an error : 'IServiceCollection' does not contain a definition for 'AddPresentation' and no accessible extension method 'AddPresentation' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)'. Also, I have references all three projects inside the WebAPI project.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Missing a using statement then?
@dangerosa01
@dangerosa01 Жыл бұрын
Very nice!! It would be perfect if you add an example, including entity, dto, use case, EF, Logging and Http request
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Covered most of them in other videos
@redachouiba4862
@redachouiba4862 Жыл бұрын
can you share Links for the example plz @@MilanJovanovicTech
@LeePaulSmith
@LeePaulSmith 2 ай бұрын
I would disagree on a few points.. 1. The WebAPI project is your presentation layer, you do not need a separate "Presentation" project. 2: Logging wasn't relevant to the video but it should be abstracted to an ILogger and it's implementation should be moved to the infrastructure project. Obviously, these are just my opinions. Your videos are some of the best on KZbin for these topics.
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
1. Agreed, but this was about controlling direction of dependencies (if one needs it) 2. You can still use ILogger with Serilog | Obviously, these are just my opinions As are mine 😅 Most software engineering is opinionated.
@muhammedhedyia7258
@muhammedhedyia7258 8 ай бұрын
Thank you for your useful tutorial. I have a question regarding the Presentation layer what is the difference between it and the WebApi project? and in case I have a project consisting of several presentations such as gRPC, WebApi, MVC, etc., what is the good way to handle all of them in a single project?
@MilanJovanovicTech
@MilanJovanovicTech 8 ай бұрын
WebApi is the composition root, and it brings them all together at runtime. Presentation is there to define the endpoints (entry points). You can move the Presentation into WebApi.
@joshem32
@joshem32 Жыл бұрын
Thanks again Milan, I have a question, if you were to add SignalR to your project where would you put the setup? I mean hubs and stuff
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Probably Infrastructure
@joga_bonito_aro
@joga_bonito_aro Жыл бұрын
I'd be interested to see why you seperated WebApi and Presentation. I don't see the point at first glance >) But thanks for your service in this community! Love this channel so much.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Separating the executable from the endpoints. So controllers, minimal Apis, view models in their own project. Comes down to preference. Nothing major.
@RonieNogueira-l8y
@RonieNogueira-l8y Жыл бұрын
@@MilanJovanovicTech So you create do WebApi only for controllers? The presentation class library will contains the filters and mappers for example?
@SteveNgaiCheeWeng
@SteveNgaiCheeWeng Жыл бұрын
Hi, what is your approach to project setup for microservices?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I'll talk about it in a future video 😁
@csdias2004
@csdias2004 Жыл бұрын
Very good content. Thank you.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad you liked it!
@PelFox
@PelFox Жыл бұрын
When would you want to use this design over modular monolith? In the end both seems to be more favored to bigger monoliths rather than small microservices.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Modular Monolith is a bigger concept than this. But each Module can use the Clean Architecture for example.
@PelFox
@PelFox Жыл бұрын
@@MilanJovanovicTech Would be a lot of projects in that single solution :) lets say you are using clean architecture and need to introduce some background processing like azure functions, for this its common you need to share code and entities. Would that function app reference the same app/infra project or how would you go about this?
@Paul-uo9sv
@Paul-uo9sv 11 ай бұрын
Within this example video, does the Presentation Layer Reference the Application Layer (MediatR Nuget was added into the Application project). ? Nice vid.
@MilanJovanovicTech
@MilanJovanovicTech 11 ай бұрын
Yes, Presentation will reference Application
@Paul-uo9sv
@Paul-uo9sv 11 ай бұрын
@@MilanJovanovicTech thanks, thought so.
@danielserafimovik6802
@danielserafimovik6802 Жыл бұрын
Great Video simple and Clean :) Good idea will be to record comparison of clean architecture approaches of ardalis vs jason taylor template. One more idea maybe to record one without use of CQRS and MediatR in the Application layer. keep up the good work pozdrav iz Makedonije :)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Pozdrav 😁 I'll take a look at Ardalis, I've used Jason Taylor's architecture before
@S3Kglitches
@S3Kglitches Жыл бұрын
The purpose of dependency injection is not to give you default settings which you then can use (the DependencyInjection class you created in backend/application layer) but that you inject the dependencies and settings on your own. This means that from the REST API project, you should be configuring the whole backend, no?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
You can use either approach
@xustis
@xustis Жыл бұрын
Thanks for the video. Can I create a web application that use that api directly or should i use web application controllers to call this api by client clases for example? If i can use it direcctly i am not sure if domain should contain logic like ViewModels, resources, etc. Very difficult to find Api with ddd and web application integration, everybody only talk about the api and i am so confused.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
So you want an MVC app with a separate API?
@xustis
@xustis Жыл бұрын
@@MilanJovanovicTech not really, i want know if i can have a web aplication in core that call api controllers, without MVC app
@RonieNogueira-l8y
@RonieNogueira-l8y Жыл бұрын
Thanks for sharing. Do you going to continue evolve this application?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Over the next few videos, yeah. Take a look at the DDD Modeling one
@rafaspimenta
@rafaspimenta 11 ай бұрын
I was very confused when I heard that the presentation layer could be a REST Web API. In this case, which layer does my frontend built-in React that consumes this Web API belong to?
@MilanJovanovicTech
@MilanJovanovicTech 11 ай бұрын
It could also be presentation layer - but I'm speaking strictly in terms of the context of a backend system
@DavidRodriguez0215
@DavidRodriguez0215 Жыл бұрын
Thanks for the video, clear and direct, I liked the theme that you have applied, can you share the name please?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Visual Studio dark theme + ReSharper syntax highlighting
@codewithkashif
@codewithkashif Жыл бұрын
Have you ever used MediatR in production? How was you experience with MediatR in terms of performance and memory consumption in case of high traffic?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Yes, worked well for me. But I can't KNOW it will work well for you. Run some load testing perhaps with your expected traffic?
@codewithkashif
@codewithkashif Жыл бұрын
@@MilanJovanovicTech yeah make sense. Actually couple of year ago i heard on internet that is only good for development environment it would suck on production real world apps So i wasn’t sure about it, although i like it very much as it keeps code highly clean, readable and maintainable!
@riatec6741
@riatec6741 Жыл бұрын
Hi Milan, can you suggest few good ways how to define the event flow between the 4 layers of CA in a diagram
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
What do you mean exactly?
@riatec6741
@riatec6741 Жыл бұрын
@@MilanJovanovicTech I need to implement CQRS in another language. So i like to know which CA layer emits(i guess application layer) and which CA layers listen to the command and query. pls pardon my ignorance on CA on this aspect as I am trying on the same
@DENDYTWOO
@DENDYTWOO Жыл бұрын
Hello! Thank you for video. I have a question - why dont you refer to application layer from infrastructure layer?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I just missed to show it in the video, in general you want to have that reference
@DENDYTWOO
@DENDYTWOO Жыл бұрын
@@MilanJovanovicTech thank you for your so fast answer! and while i was waiting that i get one more question where i can store logger service? in infrastracture or application layer? or i can create another project and store that here
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
@@DENDYTWOO I'd say Infrastructure
@kemalemin
@kemalemin Жыл бұрын
Hi Milan! Thank you for the video. You pasted in the configuration for Serilog but there is a long line that is not visible towards the end. Can you share the whole code elsewhere please?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
www.milanjovanovic.tech/blog/structured-logging-in-asp-net-core-with-serilog
@angelldark6426
@angelldark6426 Жыл бұрын
Hi Mr.Milan. I can use the presentation as wpf
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Yes
@IosifBalla
@IosifBalla Жыл бұрын
Hey Milan, first of all I like very much your videos :). Lately I also feel that the infrastructure indeed should be split in more parts like you did in your presentation: Intrastructure and Presentation and I have a question regarding this or at least I need confirmation for my thoughts :). For the case when I have an Api and a Cli built on top of my whole application then my infrastructure layer would be split in 3: Infrastructure (with core infra stuff), Presentation.Api, Presentation.CLI or? Thank you
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I'd say the Infrastructure is irrelevant here. And the real question is Presentation - should we split it in two? If the entry points are different, and it looks like they are, then it makes sense
@juhairahamed5342
@juhairahamed5342 Жыл бұрын
Good explanation
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thank you 😁
@jaydeeppatil9120
@jaydeeppatil9120 Жыл бұрын
Very Useful
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad you think so!
@nicolaimagnussen1914
@nicolaimagnussen1914 6 ай бұрын
You mentioned that the API doesnt need to import the domain layer, because it will implicitly get it from the application layer, what do you mean by that, when the application layer doesnt hold the domain logic. Was this something you did not meant to say, or could you elaborate on what you mean. Right now my API needed to import also the domain layer, since thats where the models, exceptions etc are stored. But if you have a way to get to the domain from application, I am all open minded.
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Transitive reference. Application -> Domain API -> Application, and by extension API -> Application -> Domain
@imadayoub5237
@imadayoub5237 5 ай бұрын
Thanks a lot for this greate video. I have subscribed, but I don't understand why you created a presentation layer then the api layer?
@MilanJovanovicTech
@MilanJovanovicTech 5 ай бұрын
To separate endpoints (public API) from DI logic, more control over what Presentation can reference
@harryh212
@harryh212 Жыл бұрын
Should dependency inversion interfaces for Application layer live in Domain? Where should they go?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Most of them should be in the Application layer, and implemented in the Infrastructure/Persistence/Presentation
@harryh212
@harryh212 Жыл бұрын
@@MilanJovanovicTech thanks for your reply, really appreciate it. I'm trying to wrap my head around this properly. Would use cases/ business logic that span several aggregates interfaces and implementation both sit in application layer? Should those go in the same folder? I'd like see some good examples of this. Adding to this question would an entities IRepository be in a shared entity folder in the domain layer and then implementation be in the persistence layer? Then my use case services interface and implementation would use those repositories and sit in the application layer?
@Curlack
@Curlack 4 ай бұрын
Hi Milan, should Infrastructure and Presentation have project references to the Application? Theb WebApi project only reference thise two?
@MilanJovanovicTech
@MilanJovanovicTech 4 ай бұрын
Yes
@sergiosaveas8337
@sergiosaveas8337 Жыл бұрын
Have you or anyone implemented clean architecture in older versions of the .NET framework? The company I work for is still programming using this framework and it looks to me that we could also benefit from clean architecture also so I'd like to explore this possibility. It will be a plus of course if this has already been done to see how to approach this. Thanks
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I can't remember the last time I used .NET Framework 😅 The biggest hurdle will be having a proper DI container to use. Everything else should be the same.
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
All you'd need is some DI library and you can have the same structure
@ammarahmed4140
@ammarahmed4140 Жыл бұрын
hey milan!! I saw your serilog video and implement serilog in my project. its great.. but i need logs to print in seperate folders for each controller. can you please help me out or make another video about serilog with indepth configurations. thanks 👍
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Is that even possible? 🤔
@ammarahmed4140
@ammarahmed4140 Жыл бұрын
@@MilanJovanovicTech I searched about this and found few clues but didn't make it work... but its possible in NLog configuration
@pureevil379
@pureevil379 Жыл бұрын
Where are the optionsetups added to the iservicecollection? All in application so that infrastructure and persistence can make use of them in their dependency injection class?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
The setup can be anywhere. But the options class needs to be where its used
@pureevil379
@pureevil379 Жыл бұрын
Thanks! Btw for anyone who was wondering about thjs. For EF it provided a provider to get the service options when declaring the options config (Milan shows that in a vid). But I found if that wasn't available I'd declare the options config with the setup class then use the buildservicdprovided method then with that get the options class I just binded to.
@muzluballi
@muzluballi Жыл бұрын
Nice content mate
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Much appreciated
@dev.anupsarkar
@dev.anupsarkar Жыл бұрын
I don't like CQRS and MediatR. I prefer repository pattern or hexagonal architecture. Do you have any better alternative?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Just use Services, not that much different
@abdifatahAnnaati
@abdifatahAnnaati Жыл бұрын
It will be great if you maybe implement 1 entity for that architecture(CRUD)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Just wanted to focus on the structure here
@SinanNAR
@SinanNAR Жыл бұрын
Nice video, thanks a lot
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad you liked it!
@BeyondAppearances-0
@BeyondAppearances-0 Жыл бұрын
Thanks but ideally, as expected in Clean Architecture of Uncle Bob : the Application Layer should be TECHNOLOGY AGNOSTIC, so in this layer : no dependency injection Tool, no Mediatr, and so on. All of this should go into the Infra Layer !
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Might as well remove .NET while we're at it, just to be sure 😅
@FuilcoDev
@FuilcoDev 20 күн бұрын
I have a question... I want to controllers in presentation layer, how to do?
@MilanJovanovicTech
@MilanJovanovicTech 19 күн бұрын
Explained it here I think: kzbin.info/www/bejne/qn3OZaOQj9mcers
@pilotboba
@pilotboba Жыл бұрын
Hmm... probably should as a base set up a test project with Architecture/Layers tests. Then, yea make it a template. :)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
That's a wonderful idea!
@sorteslyngel2k
@sorteslyngel2k Жыл бұрын
you did not add any references from the infrastructure or presentation layer. Those should reference the domain layer...?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Yeah, got a little carried away in the second part of the video 😅😅
@JoseMuinos-vu4nn
@JoseMuinos-vu4nn 6 ай бұрын
Shouldn't logging be configured inside the infrastructure layer ? I've seen CA aproaches using Serilog this way. Is it more optimal to configure it inside the API layer on .NET latest versions?
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
I find it simpler to configure it from Infra, that's all
@IvanFernandoPaz
@IvanFernandoPaz Жыл бұрын
how can apply this on my frontend project with react or any framework?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
No idea
@shivamjha7534
@shivamjha7534 Жыл бұрын
KING
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thank you sir! Have this 👑👑👑
@talib7508
@talib7508 Жыл бұрын
Hi, Milan Could make a video on how to do logging/caching at method level Using dynamic proxy.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I'll first have to learn what a dynamic proxy is 😁
@vivekkaushik9508
@vivekkaushik9508 Жыл бұрын
Very useful.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad it was helpful!
@llll-vw7cw
@llll-vw7cw Жыл бұрын
Can You add DDD to it and make full series how to setup DDD end to end?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Oh yeah, DDD modeling next week
@microtech2448
@microtech2448 10 ай бұрын
Does not Infrastructure project need dependency on Domain? How would you persist records without domain layer referenced in Infra/persistence project?
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
It has the Domain reference from the Application layer
@microtech2448
@microtech2448 10 ай бұрын
@@MilanJovanovicTech it means you are referring Application layer in the Infrastructure/Persistence project? Maybe I missed in the video.
@valeriyaleksandrovich2707
@valeriyaleksandrovich2707 Жыл бұрын
API project and Prasentation Layer not same, isn't it? Why create two project which do same mean?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
They can be, I just like to split them so that Presentation deals with API endpoints, and the Web project deals with plumbing everything together.
@sunilanthony17
@sunilanthony17 Жыл бұрын
I still don't get why you would create a presentation layer if you're creating a web API project. I understand it is the entry point and you will register your controllers in the web API project but why? Why not do everything in the web API project?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Just a personal preference + avoiding exposing all of the dependencies to the Presentation layer.
@omidkianifar5144
@omidkianifar5144 Жыл бұрын
I have two more layers. First is Data Access Layer or Repositories or Db layer and the second is Contract layer for request and response models
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
So you split Infra into Infra and Db? 🤔
@omidkianifar5144
@omidkianifar5144 Жыл бұрын
@@MilanJovanovicTech exactly
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Too many layers
@alwaseem5309
@alwaseem5309 7 ай бұрын
Why would the WebApi (UI layer) have a reference to the Infrastructure layer?
@MilanJovanovicTech
@MilanJovanovicTech 7 ай бұрын
Wiring up DI for one
@altkev
@altkev Жыл бұрын
can you also do one for VSA?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Yes, I said I'm planning to 😁
@tibba69
@tibba69 Жыл бұрын
Would also love to see a Vertical Slice example
@nyeinchan2945
@nyeinchan2945 Жыл бұрын
a simple project with this clean architecture please.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
In the coming videos 😁
@fredericmerouze4876
@fredericmerouze4876 Жыл бұрын
thanks for this video which is very interesting :) (ps: all your content is interesting :) )
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad you enjoyed it
@unkn0wnrge189
@unkn0wnrge189 Жыл бұрын
Do you think a new project for each layer is a good design?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I think it adds to the separation, and you can hide implementation details within the projects
Clean Architecture With .NET 6 And CQRS - Project Setup
12:40
Milan Jovanović
Рет қаралды 238 М.
The Beginner's Guide to Clean Architecture
13:19
Milan Jovanović
Рет қаралды 29 М.
У вас там какие таланты ?😂
00:19
Карина Хафизова
Рет қаралды 19 МЛН
Triple kill😹
00:18
GG Animation
Рет қаралды 17 МЛН
Smart Sigma Kid #funny #sigma
00:14
CRAZY GREAPA
Рет қаралды 100 МЛН
Clean Architecture with ASP.NET Core 8 | .NET Conf 2023
29:17
Adding Filtering, Sorting And Pagination To a REST API | .NET 7
24:02
Milan Jovanović
Рет қаралды 57 М.
Creating .Net Core Microservices using Clean Architecture
26:02
Rahul Sahay
Рет қаралды 21 М.
The Logging Everyone Should Be Using in .NET
15:34
Nick Chapsas
Рет қаралды 79 М.
How to Implement the CQRS Pattern in Clean Architecture (from scratch)
17:36
How Do I Structure My Application?
12:25
IAmTimCorey
Рет қаралды 19 М.
У вас там какие таланты ?😂
00:19
Карина Хафизова
Рет қаралды 19 МЛН