Search Results for

    Show / Hide Table of Contents

    Class AttributeValidator

    A validator that uses a System.ComponentModel.DataAnnotations.ValidationAttribute to validate a command, command line option, or argument.

    Inheritance
    System.Object
    AttributeValidator
    Implements
    IValidator
    IOptionValidator
    IArgumentValidator
    ICommandValidator
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: McMaster.Extensions.CommandLineUtils.Validation
    Assembly: McMaster.Extensions.CommandLineUtils.dll
    Syntax
    public class AttributeValidator : IValidator, IOptionValidator, IArgumentValidator, ICommandValidator

    Constructors

    | Improve this Doc View Source

    AttributeValidator(ValidationAttribute)

    Initializes an instance of AttributeValidator.

    Declaration
    public AttributeValidator(ValidationAttribute attribute)
    Parameters
    Type Name Description
    System.ComponentModel.DataAnnotations.ValidationAttribute attribute

    Methods

    | Improve this Doc View Source

    GetValidationResult(CommandArgument, ValidationContext)

    Gets the validation result for a command line argument.

    Declaration
    public ValidationResult GetValidationResult(CommandArgument argument, ValidationContext context)
    Parameters
    Type Name Description
    CommandArgument argument
    System.ComponentModel.DataAnnotations.ValidationContext context
    Returns
    Type Description
    System.ComponentModel.DataAnnotations.ValidationResult
    | Improve this Doc View Source

    GetValidationResult(CommandLineApplication, ValidationContext)

    Checks whether the command is valid using any associated validation attributes.

    Declaration
    public ValidationResult GetValidationResult(CommandLineApplication command, ValidationContext context)
    Parameters
    Type Name Description
    CommandLineApplication command

    The command line application to validate

    System.ComponentModel.DataAnnotations.ValidationContext context

    The context under which validation should be performed

    Returns
    Type Description
    System.ComponentModel.DataAnnotations.ValidationResult
    | Improve this Doc View Source

    GetValidationResult(CommandOption, ValidationContext)

    Gets the validation result for a command line option.

    Declaration
    public ValidationResult GetValidationResult(CommandOption option, ValidationContext context)
    Parameters
    Type Name Description
    CommandOption option
    System.ComponentModel.DataAnnotations.ValidationContext context
    Returns
    Type Description
    System.ComponentModel.DataAnnotations.ValidationResult

    Implements

    IValidator
    IOptionValidator
    IArgumentValidator
    ICommandValidator
    • Improve this Doc
    • View Source
    In This Article
    Back to top