Clean ASP.NET Core API using MediatR and CQRS | Setup

Поділитися
Вставка
  • Опубліковано 1 гру 2019
  • Become a Patreon and get source code access: / nickchapsas
    Check out my courses: dometrain.com
    Hello everybody I'm Nick and in this ASP.NET Core tutorial I will show you how you can use CQRS and MediatR to clean up your applications. I will briefly explain what CQRS and the Mediator patterns are and how they apply in our use-case. The I will show you how you can use the MediatR package to decouple your API layer from your application layer, leading to more testable and manageable code.
    Don't forget to comment, like and subscribe :)
    Social Media:
    Follow me on GitHub: bit.ly/ChapsasGitHub
    Follow me on Twitter: bit.ly/ChapsasTwitter
    Connect on LinkedIn: bit.ly/ChapsasLinkedIn
    #aspnetcore #mediatr #cqrs #tutorial

КОМЕНТАРІ • 321

  • @pratiks6576
    @pratiks6576 3 роки тому +9

    I don't think I could have gotten such a clear explanation of this pattern anywhere else on the web.
    Thanks Nick !

  • @najibmestaoui6950
    @najibmestaoui6950 3 роки тому +15

    You can't imagine how happy I am after watching this video! Thank you.

  • @zokocx
    @zokocx 3 роки тому +11

    Great starting tutorial with enough introduction theory, I never used MediatR or even mediator pattern (been stuck at legacy project)
    And I really like how MediatR effortlessly made implementing of query and command almost trivial in CQRS pattern.
    Keep the excellent videos coming and keep coding.
    PS: your videos are worth more than price of coffee to see the source

  • @jeremi84
    @jeremi84 4 роки тому +3

    I pressed like and subscribed by just watching the first 8 mins of this video, it's one of the best explanations without going full-blown detail yet I understand the main concept! well done!

    • @gunnerr91
      @gunnerr91 3 роки тому +1

      nick, tim corey and les jackson, all create amazing dotnet content for free and helping me out a lot!

  • @ahmedshaker1695
    @ahmedshaker1695 4 роки тому +8

    Perfect for whom wanna to start and get into MediatR and CQRS , keep up the great work man

    • @babakbahrami3384
      @babakbahrami3384 3 роки тому

      did you find the project repo on github or not?

  • @AlejandroVivas
    @AlejandroVivas Рік тому

    Video from 2019 and still applies today. This was very well explained. Thank you!

  • @sergiohuanca4812
    @sergiohuanca4812 3 роки тому +1

    Love your content Nick. I'm just a newbie but learning a lot with your videos! Greetings from Perú!

  • @triggerhappy899
    @triggerhappy899 3 роки тому +1

    Great video! Maybe because I setup my project almost identitcal. I'm loving how the code is so organized and clean!

  • @florin.soldan
    @florin.soldan 3 роки тому +1

    Really good explanation and the demo was great, not too much not too less, really good balance. Thanks!

  • @ilovepandaypoe6056
    @ilovepandaypoe6056 3 роки тому

    really really great tutorial. I was able to follow along and everything working as expected. wow!

  • @adrenalinea953
    @adrenalinea953 3 роки тому

    best video regarding MediatR and CQRS I could find! Thanks a lot!

  • @maidamsanthosh9612
    @maidamsanthosh9612 4 роки тому

    What an explanation, easily understood. Thanks for the video..

  • @ajagbequadri2926
    @ajagbequadri2926 4 роки тому +6

    this is one of the best tutorials on CQRS.

  • @mohamedelbasmy5160
    @mohamedelbasmy5160 4 роки тому

    I really enjoy watching your videos, very interesting tops and very clear explanation, Thanks you so much for all your efforts.
    we wait all your newly tutorials.

  • @ben.thornhill
    @ben.thornhill 3 роки тому

    Awesome content! You are a great teacher. Keep up the great work. I subscribed and look forward to more videos.

  • @danielchikaka
    @danielchikaka 4 роки тому

    Wow!
    Thanks so much for the wonderful video. Keep 'em coming!

  • @talkathiriify
    @talkathiriify 4 роки тому

    Thank you very much for the awesome series.
    Please keep it up.

  • @haythambaidda6045
    @haythambaidda6045 4 роки тому

    Nice presentation and implementation. Thank you.

  • @nawarajkhadka9502
    @nawarajkhadka9502 3 роки тому

    As simple as that.. The best one ever !! Thanks!!

  • @kukrejasunny9585
    @kukrejasunny9585 3 роки тому

    This is exactly what I was looking for, Thanks @Nick Chapsas

  • @ernestmfakudze
    @ernestmfakudze 3 роки тому

    Thanks Nick. Beautifully explained.

  • @digitalfriday
    @digitalfriday 4 роки тому

    really great tutorial! cant wait for part 2!

  • @mmsky
    @mmsky 4 роки тому +1

    Great tutorial, awesome explanation. Thank you so much for providing the source code.

  • @tamerezzeldin4404
    @tamerezzeldin4404 3 роки тому

    Great and simply explained. Thanks!

  • @Mexicankampungboi
    @Mexicankampungboi 3 роки тому

    Brilliant tutorial! This is very clear, thank you :)

  • @karthicks859
    @karthicks859 4 роки тому

    Nick before this video , i tried learning with the use of Event source but explanation was vague/not clear.Your video gave lot of confident in terms of implementation...Thanks a lot Nick, i subscribed too :)

  • @CollegeCode
    @CollegeCode 4 роки тому

    Excellent video Nick! Keep up the great work.

  • @giorgioqruadze1122
    @giorgioqruadze1122 3 роки тому

    This was great tutorial, thank you for sharing it with us.

  • @MrRozekkk
    @MrRozekkk 3 роки тому

    Thanks for that tutorial. Very clearly described what to use and how. I've liked that CQRS pattern :D You deserve sub and like :)

  • @emerynoel567
    @emerynoel567 Рік тому +1

    At my last job, we created our own implementation of this (I didn't know about mediatr). It worked very well and was very clean, the only downside was that we didn't do any scanning, so we had to manually map all of our query/commands and responses. We had a giant wall of them. 🙃 Mediatr looks like it would have made life a fair bit easier!

  • @greident
    @greident 4 роки тому

    Thank you man! You really help me to understand

  • @fullstackdotnet
    @fullstackdotnet 4 роки тому

    amazing explanation, keep it up, thank you.

  • @mikaeledebro1144
    @mikaeledebro1144 3 роки тому

    Excellent video! Thanks for this!

  • @anandrokzz
    @anandrokzz 3 роки тому

    Its clear! You really did a good job .👍🏼😊

  • @nikolinavukovic7165
    @nikolinavukovic7165 Рік тому

    Fantastic explanation, well done!

  • @Rahil1978a
    @Rahil1978a 4 роки тому

    Excellent explanation. I love it

  • @pawenowak5144
    @pawenowak5144 2 роки тому

    Thank You for this tutorial:) It seems pretty easy now:)

  • @bhushanmulmule7885
    @bhushanmulmule7885 4 роки тому +6

    Finally long time search ended here :)

  • @sureshsambana5219
    @sureshsambana5219 Рік тому

    Very neat and clean explanation

  • @i.paradox
    @i.paradox 3 роки тому

    Thanks a lot for this beautiful explanation.
    Good Luck.

  • @AnilKumar-xx1io
    @AnilKumar-xx1io 2 роки тому

    this class is very helpful for beginner .. think you sir

  • @md.mizanurrahmanmilon3745
    @md.mizanurrahmanmilon3745 4 роки тому +5

    Love the way you explained and it's really easy to understand. Thanks a lot, keep the amazing work.

  • @danielarandamartin2709
    @danielarandamartin2709 2 роки тому

    Thank you very much! The tutorial was awesome !!

  • @godwinyoh3700
    @godwinyoh3700 3 роки тому

    Such an amazing video. Thanks very much.

  • @ngenohillary266
    @ngenohillary266 3 роки тому

    Very Elaborate, thanks Nick.

  • @pk5006
    @pk5006 4 роки тому +1

    Perfectly explained. Now i can implement this. Thank you. ☺️

  • @harshpatel-wr1jl
    @harshpatel-wr1jl 3 роки тому

    Perfect and Cool Explanation .. Thanks sir :)

  • @vladkorsak2163
    @vladkorsak2163 3 роки тому

    So helpful. Thank you, sir.

  • @RaviKumar-td1oj
    @RaviKumar-td1oj 2 роки тому

    Good Video. It helped me to understand CQRS.

  • @armanx2
    @armanx2 4 роки тому

    Great video and very nice explanation

  • @lukasostar3008
    @lukasostar3008 4 роки тому

    crazy good intro, thank you very much!
    edit: subscribed :D

  • @DevDiegoSanches
    @DevDiegoSanches 4 роки тому

    Very good bro.. Tks for sharing.

  • @narendratiwari4889
    @narendratiwari4889 3 роки тому

    Well explained cover everything in this video 👍

  • @jojojawjaw
    @jojojawjaw 3 роки тому

    Great tutorial, thank you

  • @ssubbuanil1
    @ssubbuanil1 4 роки тому

    Good article !! Thank you ..

  • @devmahmod8121
    @devmahmod8121 Рік тому

    Very clear thank you

  • @MrRapic
    @MrRapic 4 роки тому

    Nice video, keep up the good work!

  • @sabermotamedi6041
    @sabermotamedi6041 3 роки тому

    Thank You Mr. Chapsas

  • @shashankpandey1019
    @shashankpandey1019 4 роки тому

    No doubt you are really great .🙏

  • @muhammadosama6865
    @muhammadosama6865 2 роки тому

    thanks a lot, keep up the good work.

  • @MR-ne5ww
    @MR-ne5ww 3 роки тому +38

    00:00 : Introduction
    00:22 : Mediator
    02:25 : CQRS
    05:27 : Design Overview
    06:45 : Coding

  • @hamednikzad911
    @hamednikzad911 3 роки тому

    great tutorial. thanks a lot

  • @bardin08
    @bardin08 3 роки тому

    Thank you very much. It`s great.

  • @udh001
    @udh001 4 роки тому

    Thank you so much.. I was going through all over to understand the MediatR and this extremely helped me.

  • @guitarplayer1342
    @guitarplayer1342 3 роки тому

    Most excellent tutorial.

  • @lilter6980
    @lilter6980 3 роки тому

    You’re the best, man!🙏

  • @bhagidasari9051
    @bhagidasari9051 3 роки тому

    very nice explanation

  • @mohammednhari1737
    @mohammednhari1737 4 роки тому

    thanks! clear explination

  • @edelwater
    @edelwater 3 роки тому +6

    In general this is partly the evolution from a generic service response model to send from services to controllers. I noticed that in some cases when a controller returns multiple http statuses and messages depending on conditions there is an overlap in what you want to return from the service and the return value from the controller. The generic service response model then gets a kind of mapping which makes it confusing. So e.g. if the controller returns status xx1, xx2, xxx3, xxx4, xx5 depending on conditions with different (translated) messages when are only known in the service layer in terms of "content" for the message, there needs to be a mapping somewhere between what the service returns and the controller returns. So in the end the generic model returns a model with e.g. enums or something alike but then the mapping to what http status and which translated message then gets returned (which is more difficult if they are dynamic so not a lookup) is in terms of placement still dependent on what gets being send. (for everything that is generic its easy because you could handle that in a filter or middleware)

    • @jfpinero
      @jfpinero 2 роки тому +1

      That's what error filters are for to translate service exceptions or whatever to proper return statuses. No need to re-invent the wheel with enums or whatever.

  • @randompoints
    @randompoints 4 роки тому +1

    Your explanation made it easy to understand. Thank You!
    #JetBrainsRider

  • @Ahmad.Weshahi
    @Ahmad.Weshahi 3 роки тому

    Great work, very usueful.

  • @shakirahsanromeo7863
    @shakirahsanromeo7863 3 роки тому

    You deserve more subscribers!

  • @VenkatachalapathiGarapani
    @VenkatachalapathiGarapani 4 роки тому

    simple and clear

  • @Defense89
    @Defense89 2 роки тому

    WOW Nick Chapsas what a nice formation , subscribed!!!! and also can we get the full project to follow along? like how to create the api you created and then add mediator to it?

  • @genereuxalahassa9595
    @genereuxalahassa9595 3 роки тому

    MediatR is beautiful. I loved it. Great explanation. Very helpful. Thanks a lot for the video

  • @abrahamrivera3156
    @abrahamrivera3156 2 роки тому

    Nice and sweet, sounds perfect, currently in mi job I have like 30 services and repos for every controller..... that is super dirty.

  • @johanakesson181
    @johanakesson181 3 роки тому

    Love your videos! Would be awesome if you shared your Visual Code settings and making a guide for most common commands etc!

    • @nickchapsas
      @nickchapsas  3 роки тому

      This is not visual studio code but rather JetBrains Rider

  • @AhmadAbouHamdh
    @AhmadAbouHamdh 4 роки тому

    Thank you very much

  • @hfcdocsis
    @hfcdocsis 3 роки тому

    Excellent! Very easy to follow. Well articulated.

  • @anooprawat1006
    @anooprawat1006 2 роки тому

    Just amazing stuff... 👍🏼

  • @kapquidlat1122
    @kapquidlat1122 2 роки тому +6

    I'm almost about to try using MediatR at least by itself on my amateurish MVC app but I'm reluctant about over-engineering it? What's your take on over-engineering vs following design patterns and best practices? Hope you come up with a video discussing it. Thanks!

  • @tuliomendelevio8704
    @tuliomendelevio8704 4 роки тому

    so good!!!, Tx tx

  • @DanteDeRuwe
    @DanteDeRuwe 3 роки тому

    Very interesting!

  • @clearlyunwell
    @clearlyunwell 3 роки тому

    Beautiful!

  • @davidpccode
    @davidpccode 3 роки тому +1

    This is the best explanation in the entire galaxy. Nick which tool/device did you use to draw that way?

    • @nickchapsas
      @nickchapsas  3 роки тому +2

      Thanks David! I am using a Microsoft Surface Pro 7 with the Surface pen to draw and the Whiteboard app that comes with the Surface

  • @dimalisovyk5277
    @dimalisovyk5277 2 роки тому +20

    Love those patterns, where for simple get request to fetch some data by primary key I need to create 10 intermediate classes

    • @kaczaczacza
      @kaczaczacza 2 роки тому +3

      Love those programmers that take every single pattern as a Holy Grali and think it should be applied to etery single case they face.
      Inb4: Nick provided us with easy to understand example just because it is easy to understand, and not because it is meant to be used in such a simple scenario...

  • @MrViouviou
    @MrViouviou 3 роки тому

    really nice explanation; I have been looking for a good example of mediatR since ages.

  • @sudar4587
    @sudar4587 3 місяці тому

    Thank you

  • @MaxParedes
    @MaxParedes 3 роки тому

    thank you!!!

  • @demosyello9594
    @demosyello9594 4 роки тому

    Ty, dude.

  • @davemasters
    @davemasters 2 роки тому

    This is a really great explanation - nice work, great content.

  • @anthoniG
    @anthoniG 4 роки тому

    Be nice if you could had some tests around the handlers. Been trying to find these for a while now

  • @ragerory
    @ragerory 4 роки тому

    Nice. Probably makes sense to create a BaseOrderHandler that injects all those in the ctor so as to not have to duplicate that effort in each handler class?

  • @Fasiibcs
    @Fasiibcs 4 роки тому

    Hi, I am new to your channel just subscribe after watching this video. It was actually really good.
    I want to make a few suggestions, please consider if you can,
    - Your speed is quite fast so try to explain more.
    - The content was really good but at some point, I didn't get the point, I am like what's going on and then repeat the section of the video.
    Thanks for your good work.

  • @janoslaszlo3272
    @janoslaszlo3272 3 роки тому

    Quality video!

  • @iT_dev41k
    @iT_dev41k 2 роки тому

    Hi Nick, thanks for your video, that is cool. Please could you say few words about commands should or should not return a entity or so except of result like new entity ID for example. Thank you

  • @eronmonseleoaikhina5832
    @eronmonseleoaikhina5832 2 роки тому

    Nick it would be nice if you could talk about event sourcing and CQRS together

  • @robertoaboites418
    @robertoaboites418 4 роки тому +32

    Where can i get the source code, i cant find it in your github.

  • @thenewmorocco401
    @thenewmorocco401 4 роки тому

    you are the best

  • @KenzoArts
    @KenzoArts Рік тому +1

    Nice explanation!
    I am curious to know what whiteboard drawing software are you using ?