Get the source code for this video for FREE → https://thedotnetweekly.ck.page/cqr...
☄ Master the Modular Monolith Architecture: https://bit.ly/3SXlzSt
Accelerate your Clean Architecture skills: https://bit.ly/3PupkOJ
Support me on Patreon to access the source code: / milanjovanovic
In this video, I'll show how you can elegantly introduce validation when implementing the CQRS design pattern. We will use MediatR's BehaviorPipeline feature and FluentValidaton for implementing the validation. CQRS gives us a lot of flexibility to introduce additional behavior in the request pipeline.
Join my weekly .NET newsletter:
https://www.milanjovanovic.tech
Subscribe for more:
https://www.youtube.com/c/MilanJovano...
Chapters
0:00 Validation Result
1:37 Creating the ValidationPipelineBehavior
3:38 Implementing validation with FluentValidation
6:44 Create ValidationResult with reflection
10:30 Creating a command validator with AbstractValidator
12:02 Configuring everything with DI
13:11 Testing our ValidationPipelineBehavior
14:33 Returning errors as Problem Details response
17:28 Alternative approach to returning Validation Result