REST + DDD + CA + CQRS - When it all plays together | CA & DDD From Scratch | Part 14

  Рет қаралды 42,531

Amichai Mantinband

Amichai Mantinband

Күн бұрын

Today, we'll implement an end-to-end feature in our Buber Dinner application.
We'll see what the process of adding a new endpoint looks like and how many of the topics we covered up until now come into play 🔥
Make my day on Patreon & get the source code: / amantinband .
Link to the entire playlist: • ASP.NET 6 REST API Fol...
Connect with me on 'em socials:
Twitter: / amantinband
LinkedIn: / amantinband
GitHub: github.com/amantinband
#dotnet #csharp #ddd #amantinband
00:00. Overview, Directory.Build.Props, .editorconfig & more 👀
08:30. API Modeling
11:03. Controller Endpoint
14:25. MediatR - Command
18:06. MediatR - Command Handler Skeleton
19:06. Mapster - Request to Command Mapping
18:06. MediatR - Command Handler Implementation
31:40. Mapster - Aggregate to Response Mapping
37:40. FluentValidation - Command Validator

Пікірлер: 80
@alan-
@alan- Жыл бұрын
Many discrepancies with the code from the last video... The last video the Menu.Create() method didn't have the MenuSections parameter, instead it did have parameters for the created & updated dates, which aren't here now., and the MenuSections.Create() method didn't have the MenuItems parameter, now it has. also the hostId is in a different place than before. I can only tell this by looking at where you're calling it; I don't have the benefit of seeing what your actual method now looks like. I've been following along since the beginning and now I've had to go back through videos to check where my code went wrong, but actually there are bits missing from the videos. Please, the continuity is important!!!
@nikolabosnjak9991
@nikolabosnjak9991 Жыл бұрын
Watched all videos so far, you got some skillz to transfer knowledge in a good way . Good job man! :)
@kmcdo
@kmcdo Жыл бұрын
So happy to get a long-form video! I think you are doing a great mix of short and long vods. Not only are these super educational, but I find them super inspirational; I find myself digging up some old abandoned projects/ideas and breathing new life into them using some of the concepts you are highlighting. Keep em coming!
@amantinband
@amantinband Жыл бұрын
Such a fun comment to read. Thanks, Kyle 🙏🏼
@ngocoder
@ngocoder Жыл бұрын
Great video Amichai! The sound of the video is a lot better. Looking forward to your video about validation.
@radeksendecki9922
@radeksendecki9922 Жыл бұрын
Great video, one of the best explanations on the entire internet. Good paste, straight to the topic. Fantastic presentation of practical usage of DDD and CA. Love your work!
@novaploca2080
@novaploca2080 Жыл бұрын
I have been really expecting and looking forward to this video. Thank you very much!!!
@TurgayTuerk
@TurgayTuerk Жыл бұрын
Thank you Amichai. Looking forward for Part 15.....
@mohammednhari1737
@mohammednhari1737 Жыл бұрын
Wow !! Good job thank you we learn lot from you
@user-jj5ov2lb2y
@user-jj5ov2lb2y Жыл бұрын
Very nice video, thanks.
@wvanlosser
@wvanlosser Жыл бұрын
Once again a great video! Thanks for all the work you put into providing this kind of content.
@robertroxxor
@robertroxxor Жыл бұрын
Incredible video series. the wealth of information that you provide in this series is pure gold. Thanks man.
@timschmidt5469
@timschmidt5469 Жыл бұрын
You are NOT talking too fast or too much. We have pause buttons :) Great video! Thanks!
@amantinband
@amantinband Жыл бұрын
Print screening this for my wife 😁
@serb1146
@serb1146 Жыл бұрын
I just watch twice. Once in 0.75 speed, then 1 to 1. Pause btn is also widely used :)))) It reminds me my fav guitar player, when he's performing something fast, he can easily tune a bit his guitar as well. no jokes...
@davemasters
@davemasters Жыл бұрын
Another great video. I feel quite vindicated & re-assured actually, as I follow almost exactly the same structure as you. Looking forward to the EF core video!
@sushilb7994
@sushilb7994 Жыл бұрын
Finally!!!!!!!!!! Much awaited video... Thank you Amichai!!!!!
@Mauriciog87
@Mauriciog87 Жыл бұрын
I was waiting for this, and it worth it!!! Kudos Amichai 💪💪💪💪💪!!!!
@phobia4gow
@phobia4gow Жыл бұрын
Nice video, Amichai! Looking forward to watching the validation video (with the difference between domain validation and request validation).
@yannistocreau3598
@yannistocreau3598 Жыл бұрын
Thanks for this amazing tutorial ! Can you explain how you get Mapster to work with your Domain objects as they are not supposed to have a default parameterless constructor ? I get an error when trying this on my project, and I don't see you using ConstructWith or MapWith.
@eirikr72
@eirikr72 Жыл бұрын
Great list of videos. One question, Why the infrastructure layer has references to the domain layer (28:56)? I thought this wasn't supposed to happen.
@loko-muklisfatoni1665
@loko-muklisfatoni1665 Жыл бұрын
Thank you Amichai, great as always
@musazulu7013
@musazulu7013 Жыл бұрын
I Learn a lot from you, thank you very much for sharing.
@mouradaissani8957
@mouradaissani8957 Жыл бұрын
Great video thank you, will it be better or to conceder to add another mapping step between the domain models and the store/db entities types (ex: MenuMenuEntity) since the repos will actually work with another type of models witch are the Entities?
@amantinband
@amantinband Жыл бұрын
Thanks! Depends what you use for storage. We will use EF Core. The actual tables are already a custom mapping of the domain models. I don’t think it’s necessary to introduce another layer on top of that.
@samosimoncic5020
@samosimoncic5020 Жыл бұрын
thanks for amazing video. I am wondering why the mapper was not used for mapping domain model Menu instead of factory method. Do you have any special reason for this?
@juke-duke
@juke-duke Жыл бұрын
Do you think you can make a GraphQL series with CA and DDD at some point aswell?
@hamedsalameh8155
@hamedsalameh8155 Жыл бұрын
Great video Amichai! thanks for sharing. Looking forward for more content
@MrBan001
@MrBan001 Жыл бұрын
Would the repository also return an errorOr or would ith throw an exception? for example if the id doesn’t exist.
@user-tr4og4pb3t
@user-tr4og4pb3t Жыл бұрын
מלך
@suhutwadiyo
@suhutwadiyo Жыл бұрын
Amazing!!!
@amantinband
@amantinband Жыл бұрын
🫶
@sirpeace_coding
@sirpeace_coding Ай бұрын
32:00 Isn't it easier to add these basic mappings in the ValueObject classes? Then Mapster will do conversions by himself without additional configuration. E.g. something like this defined inside MenuId: ``` public static explicit operator Guid(MenuId menuId) => menuId.Value; ```
@krccmsitp2884
@krccmsitp2884 Жыл бұрын
6:45 How come the line numbers in the editorconfig are so strange?
@tonAmiJory
@tonAmiJory Жыл бұрын
Thanks for your videos! On each, you give us new ideas to improve our code base, can't wait for the next ones! One thing, if you can help, we are still looking for the best approach of reloading an aggregate from database without exposing properties and without re-validating it.
@deadbluescreen3101
@deadbluescreen3101 8 ай бұрын
Is there any real, quantifiable and concrete advantages using MediatR adding this level of indirection to the API controller instead of just use a delegate that points to the UseCase method?
@Dimadiv
@Dimadiv Жыл бұрын
HostId and other id value objects in previous videos have had Guid Value. So, implementation of HostId.Create(string hostId) can be suggested to be [..] Guid.Parse(hostId) [..]. But in the sample request you're using "asdf" as the host id. How is it converted to Guid? Or maybe you have changed implementation of HostId to have string Value?
@jamesroot9777
@jamesroot9777 Жыл бұрын
Did you find out what the case is? Interested myself, can't wrap my head around it.
@mohcinelaaroubi8671
@mohcinelaaroubi8671 6 ай бұрын
@@jamesroot9777 Did you find out what the case is?
@jamesroot9777
@jamesroot9777 6 ай бұрын
@@mohcinelaaroubi8671 He just creates a custom string, something along the lines of: $"Host_{Guid}"
@codingsavid6509
@codingsavid6509 6 ай бұрын
@@mohcinelaaroubi8671 Did you find it? hahaha I can't tell where that .HostId.Create() comes from as if it was an Entity and not a ValueObject TT
@matthewcampbell3072
@matthewcampbell3072 3 ай бұрын
I am curious about how you might handle a scenario where (for instance), you had a very large list of dinnerIds. Would you really return that with your Menu aggregate in a response? How might this be approached? How exactly would this scale? Again, purely hypothetical (assume 100k entries)
@rohitshirgaonkar1982
@rohitshirgaonkar1982 10 ай бұрын
At 25:33 why and how did you create hostId.create, since hostId is value object and not a aggregate?
@patrykk.4630
@patrykk.4630 Жыл бұрын
Yupi! Yay! Finally! 😀 Thank you, thank you, thank you 😅
@amantinband
@amantinband Жыл бұрын
😂❤️
@pazzuto
@pazzuto Жыл бұрын
One of the reasons I moved away from Clean Architecture is the number of files in different locations. Jumping around just to make a simple change like adding a field to the domain entity is a pain! I went to Vertical Slices and I've never looked back - I now only have a "Core" project and a Web/Desktop/Mobile. I still try to keep DDD in mind, but I really stay away from technical layers.
@amantinband
@amantinband Жыл бұрын
That’s definitely a down side. Although it is a good way to avoid god files
@joseptempra3207
@joseptempra3207 Жыл бұрын
@@amantinband thanks a lot for your valuable and awesome videos. It will be interesting a video about de Vertical Slice Architecture and your opinion about taht. It seems a more practical way to do things and as Eddie says, a new way to avoid the jumping between layers... Best wishes!
@ivanvincent7534
@ivanvincent7534 Жыл бұрын
The features propagate through the layers in this video series. So it’s not as challenging as a project organised by technical folders. Also is the jumping really that bad given we can F12
@thexpand
@thexpand Жыл бұрын
Are you planning on making a video about domain events and handling them with event handlers? It would be super helpful to have it explained in more depth. I've read the Microsoft docs on this, but it doesn't go into much detail, e.g. how does it work if you handle events after committing the transaction (i.e. with eventual consistency), how do you deal with making sure that the database is in a consistent state if one of the event handlers fails, etc. Do you think it could be part of the scope of this tutorial/series?
@amantinband
@amantinband Жыл бұрын
Yup , it’s planned 👍🏼
@thexpand
@thexpand Жыл бұрын
@@amantinband Awesome, can't wait to see those! You create awesome content :)
@aehp2558
@aehp2558 Жыл бұрын
Thank you
@kylegivler8372
@kylegivler8372 Жыл бұрын
Thank you so much for sharing this video series. I have really learned so much. My only complaint is the amount of code edited off screen, at times it can make it a bit hard to follow.
@Beachjfb
@Beachjfb Жыл бұрын
Thank you so much for your amazing content. Did you plan of doing ddd with Minimal Api 7 ?. Thank you so much
@matthewrossee
@matthewrossee Жыл бұрын
Hi! Are you going to add some sort of middleware in next videos to verify whether userId specified in request matches the id contained in JWT?
@Yarkendar
@Yarkendar Жыл бұрын
Best ddd tutorials
@mindorinku
@mindorinku Жыл бұрын
Such great content. However, as always :) Waiting for new informative videos!
@DeejayWazzouille
@DeejayWazzouille Жыл бұрын
Hi ! Great content :) Already learn something after less than 5 minutes lol :) What tools do you use to highline thing on your screen ? I looked after it recently and I can't figure it out :) Keep teaching :D
@amantinband
@amantinband Жыл бұрын
Thanks! I use ZoomIt. More details here: aka.ms/ZoomIt
@luisandrade9054
@luisandrade9054 Жыл бұрын
Really love your videos Amichai, can't wait for the next one. I've been replicated all you have done so far, I'm new using visual studio code so I wanted to know when you say copilot extension do you mean GitHub Copilot extension?
@amantinband
@amantinband Жыл бұрын
Yes 👍🏼
@Mauriciog87
@Mauriciog87 7 ай бұрын
Swagger it's not working on my project, it says "No operations defined in spec!", someone with same issue?
@evgeniysir4220
@evgeniysir4220 Жыл бұрын
Prior to this video, worked through the code, but in this video encountered a problem with the lack of continuity of the code, what is done outside the video has significantly changed the structure of the units. Unfortunately I can not see the source code, as I can not transfer money through Patreon (blocked in my country of residence), also blocked all the payment cards (segregation by place of residence). 🤔
@carmineos
@carmineos Жыл бұрын
🔥
@babutschi
@babutschi 2 ай бұрын
You are beautiful and talented.♥
@abdulfattah.hussein
@abdulfattah.hussein 7 ай бұрын
any one has a source code or wrote the code by himself plz give me github link
@carloswinstonjavierllenas3117
@carloswinstonjavierllenas3117 Жыл бұрын
I'll compare tomorrow what I did in a pet project (keep track of the FIFA World Cup) including connecting to a database. Let's see what I can do better. Thanks in advance.
@demmy424
@demmy424 Жыл бұрын
CQRS and return aggregate from command look strange. Not operation result like ID but full data. Where segregation?
@amantinband
@amantinband Жыл бұрын
That’s a common approach as well. What downside do you see by returning the aggregate?
@KarwanEssmat
@KarwanEssmat 10 ай бұрын
Perfect Amichai, for more readable Category result, I want to share it with you " var subCategories = request.SubCategories.ConvertAll(sb => { var groups = sb.Groups.ConvertAll(g => Group.Create(g.Name, g.Description, g.IsActive) ); return SubCategory.Create(sb.Name, sb.Description, sb.IsActive, groups); }); var result = Category.Create( request.Name, request.Description, request.IsActive, subCategories ); "
@TrOgaN_
@TrOgaN_ 3 күн бұрын
DO NOT INSTALL STYLE COP, YOU CAN'T GET RID OF IT
@PierreThierryKPH
@PierreThierryKPH Жыл бұрын
You seem to be defining an API with routes that are known in advance by the server AND the client, like "/hosts/{hostId}/menus". If that's indeed the case, you are making a very common mistake in our field by calling this REST. The REST architecture includes the HATEOAS principle, which is completely contradicted by this kind of tight coupling between the implementation of the server and the client API.
@ondrejdlesk9352
@ondrejdlesk9352 Жыл бұрын
Hi, could you please elaborate a bit more on this?
@PierreThierryKPH
@PierreThierryKPH Жыл бұрын
​@@ondrejdlesk9352 in a REST API, the client only knows one entry URI (it might be a few, but usually you only need one) and gather any following URI in the body of the responses.
@dfytq
@dfytq Жыл бұрын
I have seen a lot of tutorials say "I won't do it like this in actual production", I am eager to know how to do it in actual production. In a typical rest API application, how do you handle DTOs, business logic, and entities? where do u put your business logic, where do you link up between the entity and Dto layer? where do you place your validation? after all, how do you ensure SOLID? Can we get a complete package in one single video?
@metlic5209
@metlic5209 Жыл бұрын
I don't see why DDD is in the video title. This is about putting things by directories and using implicit objects construction. If you are going to implement feature DDD-way, then you focus on describing and implementing DOMAIN rules in the code by exploring real-life business processes. The better title for the video: "How to build overlayered CRUD to database."
@pmpjim
@pmpjim 11 ай бұрын
Frankly, I don't like this approach, make things complex and the codes actually become poor readable and there are some weird terms like value objects, aggregates, commands, which are not natural like models, hierarchies, execute, query.... and also everything seems to be scattered into multiple layers, every layer has common..... this is personal opinion from a mainly Java guy, but thanks for sharing and I'll still be watching all the videos!
@sandromagalli8587
@sandromagalli8587 Жыл бұрын
Hi, what do you think about event sourcing? Would it be usefull in this scenario or does it work best in b2b?
Event Storming Tutorial
12:06
Sourced Group an Amdocs Company
Рет қаралды 800
Sigma Girl Past #funny #sigma #viral
00:20
CRAZY GREAPA
Рет қаралды 30 МЛН
Получилось у Вики?😂 #хабибка
00:14
ХАБИБ
Рет қаралды 6 МЛН
Is a REST API with CQRS Possible?
16:46
CodeOpinion
Рет қаралды 35 М.
Don't throw exceptions in C#. Do this instead
18:13
Nick Chapsas
Рет қаралды 251 М.
Connell Watkins  -  - Onion Architecture with DDD and CQRS
50:23
DDD East Midlands Conference
Рет қаралды 22 М.
How to start with DDD when you have a monolith - Javiera Laso - DDD Europe 2022
17:06
Domain-Driven Design Europe
Рет қаралды 11 М.
The Identity Paradox | DDD, EF Core & Strongly Typed IDs
16:15
Amichai Mantinband
Рет қаралды 28 М.
Don't Use AutoMapper in C#! Do THIS Instead!
16:17
Codewrinkles
Рет қаралды 66 М.
Спутниковый телефон #обзор #товары
0:35
Product show
Рет қаралды 2 МЛН
Худший продукт Apple
0:53
Rozetked
Рет қаралды 146 М.