CQRS Validation With MediatR and FluentValidation in ASP.NET Core Web API

preview_player
Показать описание

In this video, you will learn how to implement validation using FluentValidtaion with CQRS and MediatR in the ASP.NET Core Web API application.

Often when we build applications, we have many cross-cutting concerns. These include authorization, validating, and logging.

Instead of repeating this logic throughout our handlers, we can use Behaviors. Behaviors are very similar to ASP.NET Core middleware. They accept a request, perform some action, and then (optionally) pass along the request.

So, let’s get to work to see how we can use behaviors for the validation logic.

LINKS MENTIONED IN THE VIDEO

FOLLOW US ON SOCIAL MEDIA!
Рекомендации по теме
Комментарии
Автор

Thank you all for watching and for your support.

CodeMaze
Автор

What I can say to all of you is thanks. In the last 3 months, I started studying CQRS, and it was very difficult, but when you started the CQRS video series, all the difficulties turned into ease. Thanks! I hope you start a new series titled Domain Driven Design.

abdullrhmanelhelw
Автор

Excellent video, I will try to implement this solution in my projects. I just have one question, at the handler level, shouldn't something be implemented or just regular stuff? Is it enough to define the pipeline behavior and the type of input and output data to the pipeline recognize the type of the request and enter in to that flow? How does the pipeline know if there is a validator? by the syntax of the created class that must end in validator or is it a kind of relationship that is established with fluent validation and mediatr behind? Thank you so much.

andresbeltran
Автор

Well, a bit shame the example is so simple and for example do not cover if product already exists within some data-store. Also, throwing example is not the way things should be done

elpe