Fluent Validation library | MediatR pipeline behavior | .NET Web API - Tutorial 13
Автор: Iamluckydeveloper
Загружено: 2023-10-24
Просмотров: 565
Описание:
MediatR Pipeline Behavior
Pipeline behaviors in MediatR are classes that can be inserted into the MediatR pipeline to perform specific actions before or after a request is handled. This can be useful for things like logging, validation, authorization, and caching.
Pipeline behaviors are implemented as classes that inherit from the IPipelineBehavior interface. The IPipelineBehavior interface has a single method, Handle, which takes the request and a RequestHandlerDelegate as parameters. The RequestHandlerDelegate is a delegate that can be used to execute the next request handler in the pipeline.
To use a pipeline behavior, you need to register it with the MediatR pipeline. This can be done using the AddPipelineBehavior method on the IMediator interface.
Fluent Validation
Documentation Link - https://docs.fluentvalidation.net/en/...
FluentValidation is a .NET library for building strongly-typed validation rules. It allows you to define validation rules for your models in a fluent and expressive way.
To use FluentValidation, you first need to create a validator class for each model that you want to validate. The validator class should inherit from the AbstractValidatorT class, where T is the type of model that you want to validate.
In the validator class, you define your validation rules using the RuleFor() method. The RuleFor() method takes a lambda expression as an argument, which specifies the property that you want to validate and the validation rule that you want to apply.
Video Create by Iamluckydeveloper
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: