Validation using MediatR's Pipeline Behaviors and FluentValidation | Clean .NET Core

Validation using MediatR's Pipeline Behaviors and FluentValidation | Clean .NET Core

Nick Chapsas

4 года назад

87,693 Просмотров

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


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

Saurabh A
Saurabh A - 02.02.2023 23:05

Just one question, does adding this transient service of pipeline behavior cause significant load w.r.t to performance or it more or less same? or to be simple does this overall process of validation impact performance of the microservice?

Ответить
Soham De
Soham De - 29.09.2022 09:13

Please read this ! Or pin this
In Validation Behavior.cs file
Change the
Var context = new ValidationContext(request) ❎❎❎❌

To
Var context = new ValidationContext<TRequest>(request). ✔️✔️✔️

And also remove the using validation context at line 8.
This is because fluent api change

Ответить
Rain Ron
Rain Ron - 29.06.2022 12:29

Sir want to clear up some confusion, what is the diff. between IPostHandler and IPipelineBehavior? thank you.😊

Ответить
Cícero Foscarini
Cícero Foscarini - 15.06.2022 12:19

Hi Thank you very much for the video. I have two questions: which IDE are you using and I could not find a code on github. I'm not sure which repository to clone. Could you share it here, please? Thank you very much.

Ответить
Tech Deceptive
Tech Deceptive - 09.06.2022 09:19

Thank you Boss!

Ответить
hanspetervollhorst1
hanspetervollhorst1 - 04.02.2022 10:57

Isn't it a bit nit-picky to consider the performance impact of one throw-catch per request in the context of network communication?

Ответить
Ankit Nagpal
Ankit Nagpal - 30.01.2022 07:32

Thanks for the video.
How does multiple behaviours share data in MediatR?

Ответить
lordicemaniac
lordicemaniac - 26.01.2022 21:48

so the validation in CreateCustomerOrderCommandValidator is called before you get into the ValidationBehaviour.Handle, in fact even before ValidationBehaviour is created, this is bit confusing, I would think that the validation is actually called on line 27 .Select(x => x.Validate(context)). What if there is no ValidateionBehaviour but there is still CreateCustomerOrderCommandValidator? Will MediatR execute validation in CreateCustomerOrderCommandValidator even if its not used anywhere?

Ответить
Avis
Avis - 29.10.2021 00:56

Subscribed pal :)

Ответить
Chirag Patel
Chirag Patel - 22.10.2021 04:35

how to adjust pipeline Behavior sequence. for ex. request-> Validate-> Cache-> Response and request->Cache->Validate->Response.

Ответить
Darko Gelevski
Darko Gelevski - 18.08.2021 17:09

Do you have the code from this somewhere Nick? And can i have the link if u got it :)

Ответить
bonaoenchelcha
bonaoenchelcha - 16.08.2021 01:00

Ok, let say that I'm not going to use Exception Handler, what can be a real alternative in order to say something went wrong?

Ответить
S. Z.
S. Z. - 02.08.2021 19:18

By default mediatr.send method runs in synchronous way. How to configure it so that it works on asynchronous way?

Ответить
Gerappa
Gerappa - 22.07.2021 16:58

Brilliant work, your videos are precious and clear. Like it!

Ответить
Sajad Jalilian
Sajad Jalilian - 14.07.2021 17:30

If you have a playlist, please add it you your video descriptions. It's always hard for me to find a playlist which video is in it

Ответить
Patrick Hitch
Patrick Hitch - 09.07.2021 22:12

Is it just me or did I miss where you are translating that validation exception into a response? There is nothing in your controller to handle that exception! And no attribute on the action method either

Ответить
Somnath Roy
Somnath Roy - 28.06.2021 20:44

Are these codes still available in github? I looked for it but couldn't find it. Really loved the videos.

Ответить
James K
James K - 07.05.2021 21:26

👍🏽

Ответить
David Adler
David Adler - 23.04.2021 18:07

Thanks for the great video Nick. In the ValidationBehavior class, you mentioned that you were just throwing the new ValidationException(failures) exception for demonstration simplicity and that you would want to use an error handler pipeline rather than exception in production code. Can you point me to an example of the error handler pipeline?

Ответить
temp50
temp50 - 08.04.2021 17:49

And is it a good thing to let the raw request data to hit the action method? Every developer in the team should be aware of this behavior, otherwise one could think that the request data has already been validated.

Ответить
Eamo
Eamo - 31.03.2021 15:56

Hi Nick, do you have any video on testing the fluent validation? Would you just use some integration tests?

Ответить
Stark tony
Stark tony - 29.03.2021 11:50

How to do unit testing for this?

Ответить
codematrix
codematrix - 26.03.2021 16:35

Too much abstraction. This will be difficult to debug as you can’t drill down from the mediatR to the final handler and need to manually search for the handlers. Sounds cool and is decoupled, but the over use of design patterns everywhere increases architectural complexity. In other words don’t over engineer because you found a new tool. Always have a good balance. You don’t need this for CQRS. Use straight DI. Also meditatR makes it difficult to inject fakes during unit testing.

Ответить
Benjamin Charlton
Benjamin Charlton - 14.03.2021 14:39

I love these videos. I'm learning so much about modern patterns and practices after a long break from professional programming. Thank you! I tried to adapt the pattern in this video so as not to throw a validation exception (as you recommended yourself) but I found it to be very difficult and didn't find any good examples on the internet. Is there a pattern you recommend? Do you still believe it's important not to throw a costly ValidationException to signal an invalid command?

Ответить
Darío Griffo
Darío Griffo - 20.02.2021 01:02

No need to use a behaviour. A Preprocessor is more suitable for this.

Ответить
Common Man
Common Man - 05.02.2021 17:30

Where can I get the source code ? Could you please help me to find the source code?

Ответить
BalaKrishnan G
BalaKrishnan G - 20.01.2021 14:18

good job

Ответить
Adhi Venkatesh
Adhi Venkatesh - 20.10.2020 20:22

Hi your videos are awesome , may I know the editor your using for the dotnet core

Ответить
Lagomon
Lagomon - 16.10.2020 00:17

Thumbs up for using Jetbrains Rider

Ответить
Emmanuel Caamal
Emmanuel Caamal - 28.09.2020 02:38

Thanks for the demostration, is a exelent form to initialize with MediatR and CQRS on create API services

Ответить
James Barlow
James Barlow - 08.09.2020 02:50

Great video Nick!

In a future video it would be really nice to see how to properly apply testing when using MediatR and the CQRS pattern.

Ответить
TBPer
TBPer - 04.09.2020 18:01

Awesome video. Well-explained with perfect pace!

Ответить
Віктор Козенко
Віктор Козенко - 10.08.2020 00:30

hi, what do u think about using ActionFilter instead MediatR?

Ответить
David Price
David Price - 28.07.2020 12:14

As you mentioned Domain level validation; would you implement a validator for say "User does not exist" during a login process? If not, how would you implement this at the Handler level?

Ответить
Árthur Pinheiro
Árthur Pinheiro - 22.07.2020 00:50

Awesome content. Thanks!

Ответить
Common Man
Common Man - 08.07.2020 12:19

It's a great video.Thanks a lot.

Ответить
Asit Kumar Mohanty
Asit Kumar Mohanty - 19.06.2020 23:42

I couldn't able to find the source code on your website. Can you please provide. Thanks in advance.

Ответить
V K Vlogs
V K Vlogs - 09.06.2020 18:26

Great video but I can't access the source code either on github

Ответить
Jim Petkus
Jim Petkus - 08.06.2020 18:33

Nick, great video. I can't seem to view the source code though. I have subscribed, but still no dice. My git username is Cloudkill.

Ответить
Constantin Alupoaie
Constantin Alupoaie - 28.05.2020 10:38

cool and clean

Ответить
Abid Akhtar
Abid Akhtar - 13.05.2020 05:34

Fabulous Nick Just loved it a lot

Ответить
mmsky
mmsky - 07.04.2020 04:42

Great video but I can't access the source code either on github (I also subscribed to the mailing list)

Ответить
Steven Lemmens
Steven Lemmens - 24.03.2020 16:17

Great video. Thanks for the explanation. What tool do you use to draw on the screen like that?

Ответить
Irfan Wiharyadi
Irfan Wiharyadi - 21.02.2020 11:49

Hi, I love this, but not found this source on your GitHub. Is it?

Ответить