예제 #1
0
        public override void Configure(ArgumentValidationBuilder builder)
        {
            var validationStrategy = TryGetValidationStrategy();

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