Class AttributeValidator
- Namespace
- McMaster.Extensions.CommandLineUtils.Validation
- Assembly
- McMaster.Extensions.CommandLineUtils.dll
A validator that uses a McMaster.Extensions.CommandLineUtils.Validation.AttributeValidator.ValidationAttribute to validate a command, command line option, or argument.
public class AttributeValidator : IValidator, IOptionValidator, IArgumentValidator, ICommandValidator
- Inheritance
-
objectAttributeValidator
- Implements
Constructors
AttributeValidator(ValidationAttribute)
Initializes an instance of AttributeValidator.
public AttributeValidator(ValidationAttribute attribute)
Parameters
attributeValidationAttribute
Methods
GetValidationResult(CommandArgument, ValidationContext)
Gets the validation result for a command line argument.
public ValidationResult? GetValidationResult(CommandArgument argument, ValidationContext context)
Parameters
argumentCommandArgumentcontextValidationContext
Returns
GetValidationResult(CommandLineApplication, ValidationContext)
Checks whether the command is valid using any associated validation attributes.
public ValidationResult? GetValidationResult(CommandLineApplication command, ValidationContext context)
Parameters
commandCommandLineApplicationThe command line application to validate
contextValidationContextThe context under which validation should be performed
Returns
GetValidationResult(CommandOption, ValidationContext)
Gets the validation result for a command line option.
public ValidationResult? GetValidationResult(CommandOption option, ValidationContext context)
Parameters
optionCommandOptioncontextValidationContext