Skip to content

Request Validation

Request validation is supported using FluentValidation.

Simply create a class that implements 'AbstractValidator<>' of request dto. If present it will automatically be registered in IoC and used.

Validators are registered as singletons in IoC.

public class Validator : AbstractValidator<CommandDto>
{
    public Validator()
    {
        RuleFor(x => x.Url).NotEmpty().WithMessage($"must have a value;");
    }
}