Why I DON'T use MediatR in ASP.NET Core

Why I DON'T use MediatR in ASP.NET Core

Raw Coding

1 год назад

13,968 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@adrianspikes6454
@adrianspikes6454 - 09.10.2023 10:36

Good approach with using a high order function. Better to know several ways of solving a problem.

Ответить
@cubody
@cubody - 09.09.2023 01:11

Good way to understand how MediatR works. But this approach is like poison for a big project with a lot of requests. Indeed, a mediator can be used without knowing how to build your code architecturally - then it is deadly. But if you know how to use this library, then it saves a lot of effort and simplifies the code.

For example. I have 30 entities and each has a similar pipeline, I still need to bring everything to some single form. With this solution, I will have to write a unique pipeline and handler for each business process, bearing in mind that it may change someday.

Again, if I stick Generic everywhere, it will be just as confusing, or even worse.

The main point is not to use Pipeline Behaviours for everything that moves and does not move. This is a good friend and a good enemy in bad hands.

It is also worth considering that a separate pipeline for each request in a functional style is far from commonplace in C#, most people programs in an imperative style, there is no need to abuse it...

Ответить
@ddrsdiego
@ddrsdiego - 21.07.2023 12:04

Why build a whole toolkit when there is already a battle-tested tool? For teaching purposes? I agree! for production? Don't reinvent the wheel.

Ответить
@vitaliishmidt3704
@vitaliishmidt3704 - 08.07.2023 03:06

Really good point. Thanks for that. I would probably extend it like with factory probably or fluent builder to express all the pipelines flow exactly in the one place - directly in the endpoint.
By the way, there also should be some abstraction tho, 'cause You actually can miss some latter or something else and then some of pipeline or handler will not register properly.

Ответить
@waheedbhatti0
@waheedbhatti0 - 07.06.2023 23:00

HowToUseYourBrain LMAO!

Ответить
@gustavogomes8635
@gustavogomes8635 - 29.05.2023 13:51

The approach you took when you talked about pipelines, look like some kind of decorator implementation using functional programming! Very nice stuff!

Ответить
@adrian_franczak
@adrian_franczak - 17.05.2023 22:25

why this pipe instead od minimal api filters?

Ответить
@the-nasim
@the-nasim - 16.05.2023 19:31

I just wanted to let you know how much I admire your approach. Personally, I really appreciate how you emphasize being explicit instead of relying on magic. It's refreshing and exactly what I was looking for. I'm actually planning to incorporate a modified version of your method in my next project, because it just resonates with me. I genuinely can't thank you enough for sharing your valuable insights!

Ответить
@TheBekker_
@TheBekker_ - 15.05.2023 00:14

Its a bit of a speed run, so will have to rewatch and try this out, but really liking this approach

Ответить
@shakeuk
@shakeuk - 14.05.2023 22:54

You mighy wanna be careful showing people the service locator pattern without explaining what scenarios this is Okay, it is classed as an anti pattern, though i do feel as though its fair use when building a framework, such as you are here.

Id hate to see people injecting the ServicPprovider everywhere 😂.

Ответить
@felixnotthecat4249
@felixnotthecat4249 - 14.05.2023 21:25

Which IDE is this one?

Ответить
@mattdowns358
@mattdowns358 - 14.05.2023 17:46

This works great on a small codebase or when you only need a few commands to have pipelines. For registration I have used scrutor which works quite nicely to wire things up.

In the end, the most important part of the message here is know why you are doing something and that there are options

Ответить
@lucianbumb6690
@lucianbumb6690 - 14.05.2023 16:58

I like your videos very much, but this time you lost the main goal of library like Mediatr. I prefer Mediator because is simple and straightforward.

Ответить
@manya.korolevskaya
@manya.korolevskaya - 14.05.2023 16:37

Looks good,
How'd you implement domain events handling without MeditR?

Ответить
@cwevers
@cwevers - 14.05.2023 16:14

Aren't you rebuilding MediatR with this approach?

Ответить
@WayneMunro
@WayneMunro - 14.05.2023 15:43

the fewer dependences the better. thanks for this.

Ответить
@roko567
@roko567 - 14.05.2023 14:48

Not really sure what you achieved here. I don't agree with any of the benefits you stated.

Ответить
@mightybobka
@mightybobka - 14.05.2023 14:42

Why should we use handler classes at all if we can move their code into minimal API handlers?

Ответить
@cocoscacao6102
@cocoscacao6102 - 14.05.2023 14:28

All good, but that reflection linq query formatting. Don't, don't, don't push it all the way to the right. I hate that format, I hate it, I hate it. xD

Ответить
@iuribrindeiro5009
@iuribrindeiro5009 - 14.05.2023 14:16

I would harder use 30+ classes than using if/ELSE 🤢

Ответить