Тёмный

Using MediatR in .NET? Maybe replace it with this 

Nick Chapsas
Подписаться 295 тыс.
Просмотров 82 тыс.
50% 1

Check out the ABP Framework here: bit.ly/3zDZDmg
Check out my courses: dometrain.com
Become a Patreon and get source code access: / nickchapsas
Hello everybody I'm Nick and in this video I will show you how you can improve MediatR's performance without fundamentally changing your code, by using a source generated version of MediatR.
Give Mediator a star on GitHub: github.com/martinothamar/Medi...
This video is sponsored by abp.io.
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
Keep coding merch: keepcoding.shop
#csharp #dotnet

Опубликовано:

 

6 ноя 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 159   
@TheRicherthanyouguy
@TheRicherthanyouguy Год назад
I immediately when I was done with this video installed this nuget into a personal project and replaced MediatR. While performance wasn't a major impact for me. I wanted to be 100% certain I could switch it out without an gotchas Nick may have missed but so far everything is working flawless. Giving this repo a star for sure.
@darkclove7365
@darkclove7365 Год назад
This is becoming my favorite youtube channel real quick! I usually have your videos running in the background while working.
@buriedstpatrick2294
@buriedstpatrick2294 Год назад
This is exactly what I've been waiting for in terms of the Mediator approach. I think I've seen this library before but just assumed it was a typo-squatting thing haha.
@tanglesites
@tanglesites Год назад
I was using this today, on a project I am working on, had some problems, mainly because DbContext is Scoped and the Handlers are Singletons. But this was easily fixed by adding the options of the AddMediator() method and changing ServiceLifetime to Scoped. Just in case someone has the same issue. Also note that in the non-pre-release version the options method was not available inside Program.cs. I did not attempt the alternate way. Great Video, and as always great advice.
@abdullahghadawi6847
@abdullahghadawi6847 Год назад
@Tanglesites from where you change the ServiceLifetime to Scoped? No overlaod for method "AddMediator" taskes 1 arguments for "Mediator.Abstractions" Version="1.0.5"
@tanglesites
@tanglesites Год назад
@@abdullahghadawi6847 inside the AddMediator( options => ... ) extension method. Like Nick said, use the prerelease version.
@neeftgamer
@neeftgamer 11 месяцев назад
The creators of the package can make this deviation between MediatR and Mediator a bit more obvious! Only stating that: "MediatR (...) does transient service registration by default, which leads to a lot of allocations. (...) IMediator and ServiceFactory services are registered as transient (not configurable)." is a bit quick! There is a big reason why Jimmy does it they way he does and having a scoped DbContext, or any scoped/transient dependency, makes it clear why Singleton is not the best options. Of course it is faster. Btw. the options is now in the final version (but yeah 9 monhts later 😅)
@MohamedAymn
@MohamedAymn 6 месяцев назад
You saved my day ♥
@RZEPEX_SPOT
@RZEPEX_SPOT Год назад
I will check it in private projects but I'm not sure I would dare to implement it in my employee's projects because of maintenance of the new Mediator. Nevertheless kudos for the author and all the participants ;)
@jeffrbake
@jeffrbake Год назад
That's my worries exactly. This doesn't seem production ready in an Enterprise environment
@SEA_887
@SEA_887 Год назад
I wonder how this affects when doing the k6 testings. Thank you Nick!
@brianm1864
@brianm1864 Год назад
I add ONE comment about how I like MediatR and you hit me with this... now I have to decide whether to continue to use MediatR or switch to Mediator. Thanks Nick 🤔🤔🤔
@crazyfox55
@crazyfox55 Год назад
I would love to see a video from you about source generators. I don't plan on implementing my own any time soon but I would like to know how they work such that I can debug better. Edit: I found two of your source generator videos.
@zachedo3538
@zachedo3538 Месяц назад
That's amazing Nick thanks for sharing
@TimmyBraun
@TimmyBraun Год назад
Great video about performance "compaints"! 😄
@nickchapsas
@nickchapsas Год назад
I like how I checked it before I published it too
@TimmyBraun
@TimmyBraun Год назад
That was fixed fast 😄
@obiwanjacobi
@obiwanjacobi Год назад
Source Code generation all the way. Anything you can fix at compile time will help you at runtime.
@quadralm3574
@quadralm3574 Год назад
Hi Nick. You talked at one point about mediatr "you like to use it, when it does made sense". Do you have a video about when to use it or not? Or do you mention it in one of your courses. Thx for your great content!
@slowjocrow6451
@slowjocrow6451 10 месяцев назад
Id like this too. There's so many things out there but I never understand when I should be implementing them
@unclelhix
@unclelhix Год назад
1st brother, all your tuts are great 👍
@antonmartyniuk
@antonmartyniuk Год назад
I really like this library. It's trully a game changer!
@andikasaputra1390
@andikasaputra1390 Год назад
can you review sqlkata query builder, compare to dapper in term of performance?
@cptnbangatron2221
@cptnbangatron2221 3 месяца назад
I just replicated this solution in .NET 8, while using transient instances of the 'new' mediator. While I saw slight improvements in execution time and memory allocation, it was marginal compared to what you are showing. Maybe it's time to revisit this topic? Also it would be awesome if you could share the code of the examples you make in your videos. Cheers!
@volodymyrliashenko1024
@volodymyrliashenko1024 Год назад
Please anybody, could you explain what problem MediatR solves? Are there opensource real world project with MediatR? I would like to see how it looks in complecated projects.
@raybelmo
@raybelmo Год назад
You are a game changer!
@xxXAsuraXxx
@xxXAsuraXxx 11 месяцев назад
A question, in mediator pattern do most business logic happen in the controller as opposed to service layer in traditional layers architecture?
@zagoskintoto
@zagoskintoto 10 месяцев назад
Mediator is used to implement the CQRS pattern mostly. Business logic happens either in the command handlers or in the domain objects themselves (if using DDD). Of course you can be pragmatic about it and have some domain service that handles business logic too. Generally command handlers retrieve whatever is needed from repos and perform the necessary operations by calling upon methods on the objects or the repos and that's it.
@samysammour9983
@samysammour9983 Год назад
It is a great video and a great aspect! However, I would rather still use MediatR as a well-known and good-maintained package in customer projects. These micro-performance approaches do not play a big role in my opinion. I happened to use a well-known NuGet Package that contains a bug which I discovered after using it for 2 Months I had to refactor my code and report the bug and it wasn't easy. So, I'd rather stay on the safe side but it is still worth mentioning as another option and I might use it in my private code as well.
@tofu1687
@tofu1687 Год назад
Great video as always I just wonder about the debugging experience - with auto generated code it seems to me that you should be able to step in (I should check it)
@nickchapsas
@nickchapsas Год назад
You can step in, as long as you've configured the debugger to step in the code
@Timelog88
@Timelog88 Год назад
The problem I often see with packages such as MediatR is that it's often used in more monolithic application as a separation between application layers, which makes sociable tests (using real collaborators) a pain. I do see benefit using this at the edges of an application though, as the interface is pretty simple to mock or fake when you want to hide external API's in your test.
@andersforssen4190
@andersforssen4190 Год назад
This seems solid. I'll admit that at first I felt hesitant due to 3 contributors and nothing done since Aug 12... but then I thought that it seems like it would be a relative painless procedure to swap in the old MediatR if this goes stale, so why not go for the more performant version? Time will tell I guess. :)
@nickchapsas
@nickchapsas Год назад
Considering that MediatR itself is a pretty stale project because it’s feature complete, I wouldn’t worry about the commits, since there is feature parity already
@alexisfibonacci
@alexisfibonacci Год назад
Have you ever compared the memory and performance per request of MediatR to MassTransit.Mediator?
@codearabawy
@codearabawy Год назад
What about the maintainability of the new project? I'm not convinced yet to use it in Enterprise environment.
@Adronius
@Adronius Год назад
Why do you used record instead of class for the Request?
@kiran-Joy
@kiran-Joy Год назад
Why is this not a pull request on MediatR ? How long it will be maintained as a parallel project ? Considering both are opensource (MIT) ?? Especially since it even decided to use the same name , i feel like it would have fit more for a great pull request that can be merged into MediatR
@hernanar3647
@hernanar3647 Год назад
I ask to MediatR mainteiner abouth accept a PR in a discussion in his repository and he said "No, sorry, that's not code I want to maintain."
@mahmudyahyayev6481
@mahmudyahyayev6481 8 месяцев назад
I have an application in clean architecture. I wanted to switch from Mediatr to Mediator for performance reasons. But there is a problem here. The problem is that Mediator forces our objects to be in the same project as the Library. Will there be a solution for this?
@yufgyug3735
@yufgyug3735 Год назад
at this point, is there any reason to use the old mediatr?
@IceQub3
@IceQub3 Год назад
I mesured MediatR bottlenecks in our project and for long running services, the problems are more by gc pressure and less by reflection, because almost all reflecrion is done at startup and not in hotpaths (in request handlers in http servers) Sometimes, object pooling solves most problems.
@IceQub3
@IceQub3 Год назад
I must add that personaly I dislike the service locator pattern
@nickchapsas
@nickchapsas Год назад
I never said that the problem is reflection. It is the function resolvers that generate the handlers for the requests that cause the problem (though memory pressure and gc pauses)
@IceQub3
@IceQub3 Год назад
@@nickchapsas thank you for the good video and the reply, I am sorry if I misanderstood. But what I understand is that source generators cleans the reflections and the dictionary lookup, the first is only startup and the second will be very low impact inside an api service. Even with code generation transient and scoped handlers must be allocated and garbage collected. Using factory di methods its possible to ease GC pressure and still have most mediatr features. I asume pooling can be used with this Source generated package to have even better performance. Thanks for the great videos and streams
@abhaysrivastava3642
@abhaysrivastava3642 11 месяцев назад
I implemented same in my project and after doing all necessary changes, the source generated file by mediator is giving error stating that :- Error CS8120 The switch case is unreachable. It has already been handled by a previous case or it is impossible to match. I searched in generated file there are 3 switch case for one handler. and this is happening for every handler in my project approx. Why it is happening ? Am I missing something ? Please help me into this. My project is web api .Net7 version and I have installed both packages. Please help me asap...
@jorgen7842
@jorgen7842 Год назад
Not sure which version of MS Dependency Injection are you using, but there is an error with 6 + when you try to register Mediator, looks like the AddMediator extension exists in both MS and Mediator.SourceGenerator and throws an error "ambiguous method"
@mohamedelbasmy5160
@mohamedelbasmy5160 5 месяцев назад
did you find a solution for this issue? I'm facing the same issue
@jorgen7842
@jorgen7842 4 месяца назад
@@mohamedelbasmy5160 not, I gave up and used the old mediator, I haven't tried recently
@shakeuk
@shakeuk Год назад
You mention a switch statement is faster than a dictionary... but from what I understand a dictionary is typically faster than a switch statement but would potentially allocate more memory (depending on the number of cases in the switch statement), also the compiler might decide to use a dictionary in the output IL code rather than creating if else statements again depending on the number of cases.
@nickchapsas
@nickchapsas Год назад
No it's not and no the compiler won't decide to use a dictionary to the IL if you use a switch. You are making a lot of false assumptions there. I've covered all this in a video on improving the performance of enums in C#
@shakeuk
@shakeuk Год назад
@@nickchapsas I have already watched that video back when you released it, since I do enjoy your videos 😁, but that video doesn't talk about how the compiler compiles switch statements, I would link to (admittedly old) sources which show the compiler will compile the switch to different IL depending on case numbers etc. But RU-vid doesn't like that, it may be old and not be true anymore since the dotnet compiler is always getting better.
@DaveRogers-et4cv
@DaveRogers-et4cv Год назад
I hand roll my Mediator/Decorator stuff. Succinct code and does all that I need (basically the same as MediatR sans the Publish notification feature). Why? It removes a dependency that I just don't need.
@MRender32
@MRender32 Год назад
Whenever a scenario is changed from run-time to compile-time source generators, the speed and allocations go down but the binary size goes up. whenever you have benchmarks comparing old vs. new approaches, it would be helpful to also compare relative binary size
@gamedev_expert
@gamedev_expert Год назад
@@MiningForPies application startup time can be different since we give more work to JIT. But it''s important in a very few cases, generally ahead of time > reflelction
@nickchapsas
@nickchapsas Год назад
Runtime operations have way longer times than compile-time ones, even if you include the JIT
@David-rz4vc
@David-rz4vc Год назад
From your time working with Java, is there a mediator for it? Without the whole event sourcing.
@nickchapsas
@nickchapsas Год назад
The Java world is obsessed with differeny patterns. Mediator is mainly a .NET ecosystem thing
@edvardpitka3902
@edvardpitka3902 Год назад
Mediator has nothing to do with event sourcing just fyi
@David-rz4vc
@David-rz4vc Год назад
@@edvardpitka3902 yeah it's used for CQRS. What I meant was in Java when learning about CQRS they always uses event sourcing. An ex, is with Axon server. But was jus wondering if there is the mediator alternative for Java without having to use their controller, service, repository patterns. I don't even know why they try to have "thin" controller in Java when their services class is huge.
@randompointlessness2766
@randompointlessness2766 26 дней назад
I could only make the new Mediator work using singleton and had to add my other service with addSinglelton as well, or else I get - Some services are not able to be constructed error
@ryanseipp6944
@ryanseipp6944 Год назад
Curious how actively this new Mediator is going to be maintained. I see the repository hasn't been committed to since August 14th
@nickchapsas
@nickchapsas Год назад
That’s because of the feature parity with current MediatR. MediatR itself is pretty in active because it’s effectively feature complete.
@ryanseipp6944
@ryanseipp6944 Год назад
@@nickchapsas that's good to know, thanks!
@goolom
@goolom Год назад
I’ve been using this library for a while. You can see I’m the last issue on it. It’s a good library, the creator is very responsive, and if you have have concerns, your welcome to make pull requests also
@owns3
@owns3 Год назад
will this be merged into the main project? or maybe some of the changes like ValueTask?
@nickchapsas
@nickchapsas Год назад
Highly unlikely especially considering that this has been possible for a long time and the package existed for a long time too. I haven't seen Jimmy try to merge source generated Automapper implementations either which would arguably benefit way more from something like this
@MarusykRoman
@MarusykRoman Год назад
I need to discuss it with Jimmy 😅
@Didymus888
@Didymus888 Год назад
It's not just performance complaints that people have about mediator. It's the dependency hiding that it introduces everywhere in your code. If you use traditional service architecture you can see clean dependency tree with all your services
@nickchapsas
@nickchapsas Год назад
Or the ability to use Mediator with the new NativeAOT capabilities which is also pretty sweet.
@andrewshirley9240
@andrewshirley9240 Год назад
@@nickchapsas I'm not sure OP was saying the source generated MediatR solved this problem. It certainly makes it *better* since you can step into without having to locate the actual source file and get a good idea of what's going on. But there's still no direct line you can draw between the point the Send function is called and the source code that runs when you call it, and the amount of work is elevated from "right click --> view implementation" to "set breakpoint --> run --> step into --> note class name --> stop debugging --> solution search name --> identify and open file." This is a HUGE process problem being introduced into the application, and most people honestly get very little tangible benefit, so it's a net loss for most. The way people get around this, that I've seen, is putting the requests and the handlers in the same source file so you can view implementation on the request and do just fine. And that can work if you keep stuff simple, but I've seen people get inheritance involved and it was a nightmare lol
@hemant-sathe
@hemant-sathe Год назад
@@andrewshirley9240 just like there is a way to step into the generated code, there is a way to write your generated code to file system on build. That would give you ability to navigate to implementation.
@renynzea
@renynzea Год назад
@@andrewshirley9240 I'm not sure how other people use mediator. Where I work, all handlers have a command object of type IRequest, which will be a one-to-one with the handler, and the handler is IRequestHandler. When calling Send we create a new command, pass in any args (or an empty object if there are no args). So if we go to the controller we can CTRL + click on the command to go to command file. To simplify matters further, we combine the command and handler in the same file, since the command is useless without the handler. That gives us quick access to the handler from the controller. No breakpoints required to figure out what is getting executed.
@MrHeavyRunner
@MrHeavyRunner Год назад
@@andrewshirley9240 Exactly one of the reasons we removed it from our project after playing with it little bit.
Год назад
Nick benchmark test video 09:41 weather_old calling faster mediator and weather_New method calling old mediator, I think there is conflict :)
@nickchapsas
@nickchapsas Год назад
No it doesn't Old uses old MediatR and new uses the new source gen
@dlandi
@dlandi Год назад
Bravo.
@albertkunushevci5667
@albertkunushevci5667 Год назад
I like the way how this library is implemented but I have a concern, It uses ValueTask and as I know ValueTask should used only on hot-paths, It is really messing my mind sometimes and I'm not sure when to use ValueTask correctly, if you know more about ValueTask can you please make a video, like can we use Task inside a method that return ValueTask like this Mediator Package and around. I know that you also have a video with ValueTask but it explains that we should use it only on hot-paths. Thank you!
@nickchapsas
@nickchapsas Год назад
Here you go: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-mEhkelf0K6g.html
@albertkunushevci5667
@albertkunushevci5667 Год назад
@@nickchapsas I mentioned that I know it, and It describes to use on hot-path same description as the inventor of ValueTask did, but I want to know more about it. Ex: other cases like EFCore that uses it also when is not hot-path there. Thank you.
@bugsoli
@bugsoli Год назад
Nice library, but any chance to make it work with FluentValidation?
@nickchapsas
@nickchapsas Год назад
Why wouldn't you?
@bugsoli
@bugsoli Год назад
@@nickchapsas I know the nice thing with MediatR is its "pretty much" automatic integration with FluentValidation if you're using the proper dependency. Here I feel like I have to change to pipelines so it's not really plug & play anymore 😅
@nickchapsas
@nickchapsas Год назад
@@bugsoli You'd have to write the pre-pipeline which is literally 10 lines of code
@kabal911
@kabal911 Год назад
@@bugsoli you still need to implement a BehaviorPipeline for fluentvalidations with MediatR
@bugsoli
@bugsoli Год назад
@@kabal911 correct after going back to my code, I see that the MediatR.Extensions.FluentValidation does just that... weirdly though when I code it myself using Mediator, it does not validate so I'm missing something somewhere 🙂
@hernanar3647
@hernanar3647 Год назад
I like this, so much. But, is too similar to MediatR approach that I feel bad about use it (But, I'll). If this happens to be a PR, I'll use it without any complaint
@nickchapsas
@nickchapsas Год назад
I think that using MediatR's API is a very smart choice by the creator. You basically get a drop in replacement which would be the biggest migration complaint.
@hernanar3647
@hernanar3647 Год назад
@@nickchapsas Exactly, it is! Is by far the smartest idea I ever see. But, I don't know... I just feel bad about use it, is like said "I'm using your evil twin now" to MediatR Leaving aside the moral issue, I'll see it. I have a framework that uses MediatR approach, and this can be a pretty usefull upgrade for performance and memory use
@koldolmen5837
@koldolmen5837 Год назад
Can you do more mediatr content? Like pre and post processors. Good tips and such
@cdarrigo
@cdarrigo Год назад
What are the downsides to this approach? Why hasn't Jimmy rolled these changes into the base MediatR?
@nickchapsas
@nickchapsas Год назад
There aren't any downsides in this particular scenario. Jimmy makes packages for him and he happens to open source them so I assume it's because he himself, doesn't need to.
@DanielAWhite27
@DanielAWhite27 Год назад
It’s worth to have a discussion up there. I’d love to see these merged and just an option in MediatR
@jasdefer
@jasdefer Год назад
Isn't the code base larger with the source code generation? (Not that really is a relevant disadvantage)
@DanielAWhite27
@DanielAWhite27 Год назад
@@jasdefer which? MediatR or the application? The source generator would be at compile time and not committed
@jasdefer
@jasdefer Год назад
@@DanielAWhite27 thanks, I thought that the application would be slightly larger, because of the code (switch statements) generated.
@XKS99
@XKS99 Год назад
What are the drawbacks to this approach?
@nickchapsas
@nickchapsas Год назад
Not any real drawbacks. The only thing I can think of is that you assemble all be bigger due to source generation but it’s not really a “drawback”
@XKS99
@XKS99 Год назад
@@nickchapsas Good to hear. At some point maybe you take a look at Actor models with message queues and maybe contrast with the mediator pattern, especially in CQRS context.
@Aweklin
@Aweklin Год назад
Hi Nick, thank you for this as always. Is there a way to access HttpContext from a request handler? I added a filter to my (minimal API) endpoint to validate the API key, coming from the request headers. Upon successful validation I need the value to Generate JWT for subsequent requests. Is there a workaround to this? Need a code sample.
@ebrahimmansur9815
@ebrahimmansur9815 Год назад
One important qustion how maintainable is the new "mediator" ? and again a great video nick 👌👌
@nickchapsas
@nickchapsas Год назад
What do you mean by “maintainable”?
@robertnull
@robertnull Год назад
3:07 Define "good" and "bad" reflection, please?
@nickchapsas
@nickchapsas Год назад
I have touched on this on many videos but I might make one dedicated to this topic so I can link to it.
@protox4
@protox4 Год назад
"Good" reflection is only done once at start-up and all results are cached for fast lookup during the life of the application. "Bad" reflection is done every time something is needed, slowing down the application.
@jorsang1
@jorsang1 Год назад
Isn't Jimmy thinking on migrating to a source generator version, too?
@nickchapsas
@nickchapsas Год назад
Is he? Has he talked about this publicly?
@SparkeyAvalon
@SparkeyAvalon Год назад
I hope the original developers "buy" the new one. And just do source generation in a future version.
@megasuperlexa2
@megasuperlexa2 Год назад
I have yet to see a project that benefited from MediatoR and likes. On the other hand I've seen plenty, that got very hard to support because of it (speed is not the main problem)
@wdoering01
@wdoering01 4 месяца назад
Have you ever tried Mediatr-ts?
@Unleash132
@Unleash132 Год назад
I really like the idea though there's no way I can put this on production code at its current state. only 10k downloads... I will never get approval for this. on personal projects, sure.
@nanvlad
@nanvlad Год назад
But what's wrong with MediatR performance? Is it bad for stress-testing or with high amount of user requests? For me it seems like we created a problem and then we created a solution for a problem we created 😆
@nickchapsas
@nickchapsas Год назад
As you can see in the video MediatR has a high memory footprint per request. When you're working with 100s or 1000s of requests per second, you build up memory pressure that needs to be garbage collected, leading to micro pauses. This can have a big effect in performance and I've shown a video in the past on how the MediatR version is slower than the non-MediatR version in real world scenariors.
@nanvlad
@nanvlad Год назад
@@nickchapsas yep, I saw that video. But I'm just wondering whether we really need to use MediatR all over the place because it's handy and popular, or we could use it for the real problem solving?
@lordicemaniac
@lordicemaniac Год назад
@@nanvlad this is what I was wondering lately, usually MediatR is used just to separate controller from its action handling code, you could easily add "businessProvider" class for each action in controller and into the constructor and call its handling method in their action, you would get same thing like with MediatR if you don't use anything more from MediatR like automatic command/query validation or other middleware stuff. Using MediatR in every project makes you "cool" even if the project rly doesn't need it :)
@kabal911
@kabal911 Год назад
@@lordicemaniac for us, using mediator has nothing to do with “being cool” and everything to do with having simple, consistent patterns that are easy to understand. Sure, you can implement your own way of doing things, but if it’s not based on generics, then you probably end up with lots of dependencies injected into your controller, or you have some sort of “wrapper” dependency that has the other dependencies injected into it. So to do it nicely, your probably end up implementing mediator, just a worse version. Funny how no one has a problem using controllers/actions, which IS the mediator pattern.
@diligencehumility6971
@diligencehumility6971 Год назад
Interesting. But as most developers, I try to cut down on 3rd party lib's in my core, MediatR is already one of the only 3rd party lib's I have. I see no reason why this should not be a default feature in MediatR. I hope it will become.. because I am not using this random lib in my production environment
@nickchapsas
@nickchapsas Год назад
I don't understand the obsession with cutting down your 3rd party libs. I've heard the reasons but I find them silly or maybe more valid for the .NET Framework times. I would be very surprised if Jimmy changes MediatR to be source generated, especially considering that he hasn't done that with Automapper which is a way more obvious and fitting migration.
@codex4048
@codex4048 Год назад
When is a random lib not a random lib anymore?
@murilomorilonalmeida143
@murilomorilonalmeida143 Год назад
​@@nickchapsas I don't understand the obsession with 3rd party as well. The worst-case scenario is something being completely abandoned but the alternative is to either implement it yourself or skip it altogether. What is the point of not using libraries if they are available? I've heard the reasoning for it, I just never had any issues in my 10 years working as developer. The only problems I had were with library encapsulation, which to me usually means "adding bugs that wouldn't exist otherwise" and "adding complexity and maintainability issues that you wouldn't have."
@diligencehumility6971
@diligencehumility6971 Год назад
@@nickchapsas You of all people should understand. 3rd party is unauthorized code, you don't want that in your core. You don't wanna stumble upon a bug you don't have control over, because it resides inside a 3rd party lib. It's not an obsession, it's just logical common sense and widespread knowledge among experienced developers.
@diligencehumility6971
@diligencehumility6971 Год назад
@@codex4048 You decide for yourself, it's your responsibility your code works right. MediatR has 86M downloads and 60+ contributors. It's well known in the programming community. Well tested. I think MediatR qualifies as "not random", but dude, you decide what is random for you.
@VishalAnand24
@VishalAnand24 Год назад
I have used MediatR in production at scale. It provides no actual value except for • hurting performance • breaking static analysis • turning compile-time errors into runtime errors • making it impossible to just read the code to see how it flows from one method to the next introducing new classes of bugs such as running the action handler before the validation handler because they were registered in the wrong order and new package seems to be no different
@Tellalca
@Tellalca Год назад
I don't like code generation and I don't have any projects which require a thousandth of a millisecond improvement on an operation. I won't use it currently. Memory allocation might be considerable though but it needs deeper analysis.
@tesfayekebebe2553
@tesfayekebebe2553 Год назад
Thank you. It is good video you have made. I have implemented in single api with out clean architecture. It works well. but after I implemented in clean architecture it throws exception like the following. Error: Internal Server Error Mediator.MissingMessageHandlerException: No handler registered for message type: Application.Business.Categories.Queries.GetCategory at Mediator.Mediator.ThrowInvalidMessage(Object msg) in Domain/Mediator.SourceGenerator.Roslyn40/Mediator.SourceGenerator.IncrementalMediatorGenerator/Mediator.g
@mahmudyahyayev6481
@mahmudyahyayev6481 8 месяцев назад
I encountered the same problem. I think the reason for the problem is that the objects (mediator) and packages (mediator dll's) are not in the same project.
@tesfayekebebe2553
@tesfayekebebe2553 8 месяцев назад
Thank you I will try it.
Далее
Don't Use Polly in .NET Directly. Use this instead!
14:58
The New .NET 9 HybridCache That You Must Upgrade To!
14:34
Копия iPhone с WildBerries
01:00
Просмотров 368 тыс.
His reaction 😳 (via @kaitlyn.b0506/TT) #shorts
00:10
Qalpoq - Kichkina tabib (hajviy ko'rsatuv)
30:41
Просмотров 325 тыс.
Stop using the HttpClient the wrong way in .NET
10:14
Просмотров 187 тыс.
Advice from a 20-Year Programming Veteran
11:00
Clean ASP.NET Core API using MediatR and CQRS | Setup
22:39
You DON'T want an In-Memory Event Bus like MediatR
11:20
Don’t Use UUIDs/GUIDs in Databases. Use this Instead
10:36
Build Clean Messaging in .NET with MassTransit
21:44
Просмотров 95 тыс.
The Best Way to Add Health Checks in Any .NET App
12:31
The Blazor Competitor is Here!
15:08
Просмотров 67 тыс.
Копия iPhone с WildBerries
01:00
Просмотров 368 тыс.