public override void Configure(ArgumentValidationBuilder builder) { var validationStrategy = TryGetValidationStrategy(); if (validationStrategy is null) { builder.UseValidator(ValidatorType); } else { builder.UseValidator(ValidatorType, validationStrategy); } }
/// <summary> /// Overrides global <see cref="InputValidator"/>. /// Uses <see cref="TValidator"/> to resolve <see cref="InputValidator"/> with <see cref="ValidationStrategy{T}"/> /// </summary> public static ArgumentValidationBuilder UseValidator <TValidator>( this ArgumentValidationBuilder builder, Action <ValidationStrategy <object> > validationStrategy) where TValidator : class, IValidator { return(builder.UseValidator(typeof(TValidator), validationStrategy)); }
/// <summary> /// Overrides global <see cref="InputValidator"/>. /// Uses <see cref="TValidator"/> to resolve <see cref="InputValidator"/> with <see cref="ValidationDefaults.ValidationStrategies.Default{TInput}"/> strategy /// </summary> public static ArgumentValidationBuilder UseValidator <TInput, TValidator>(this ArgumentValidationBuilder builder) where TValidator : class, IValidator <TInput> { return(builder.UseValidator <TInput, TValidator>(ValidationDefaults.ValidationStrategies.Default)); }
/// <summary> /// Overrides global <see cref="InputValidator"/>. /// Uses <see cref="TValidator"/> to resolve <see cref="InputValidator"/> /// </summary> public static ArgumentValidationBuilder UseValidator <TValidator>(this ArgumentValidationBuilder builder) where TValidator : class, IValidator { return(builder.UseValidator(typeof(TValidator))); }