/// <summary> /// Initializes a new instance of the <see cref="DataErrorInfoHelper"/> class for a target object with the /// supplied source and ruleset. /// </summary> /// <param name="target">The target object.</param> /// <param name="source">The source for validation rules for the target object.</param> /// <param name="ruleset">The ruleset to use when retrieving rules for the target object.</param> public DataErrorInfoHelper(object target, ValidationSpecificationSource source, string ruleset) { if (target == null) throw new ArgumentNullException("target"); this.target = target; this.targetType = target.GetType(); this.source = source; this.ruleset = ruleset; }
public static void SetUsingSource(FrameworkElement element, ValidationSpecificationSource property) { if (element == null) throw new ArgumentNullException("element"); element.SetValue(UsingSourceProperty, property); }
public MockIntegrationProxy(object rawValue, string ruleset, ValidationSpecificationSource specificationSource, string validatedPropertyName, Type validatedType) { this.rawValue = rawValue; rulesetField = ruleset; specificationSourceField = specificationSource; validatedPropertyNameField = validatedPropertyName; validatedTypeField = validatedType; }
/// <summary> /// Creates an instance of PropertyValidator /// </summary> /// <param name="objectToValidate">The object to validate.</param> /// <param name="propertyName">The property for objectToValidate</param> /// <param name="ruleset">The optional ruleset to use for validation.</param> /// <param name="specificationSource">Whether to use validation rules from attributes, config file, or both.</param> public PropertyValidator(object objectToValidate, string propertyName, string ruleset, ValidationSpecificationSource specificationSource) :base(null, null) { _ruleset = ruleset; _typeToValidate = objectToValidate.GetType(); _propertyName = propertyName; _specificationSource = specificationSource; _objectToValidate = objectToValidate; }
/// <summary> /// Create a new instance of <see cref="ValidationSpecificationSourcePolicy"/> /// with the <see cref="Source"/> property initialized to the given value. /// </summary> /// <param name="source">The desired <see cref="ValidationSpecificationSource"/>.</param> public ValidationSpecificationSourcePolicy(ValidationSpecificationSource source) { Source = source; }
public static bool IsSet(this ValidationSpecificationSource source, ValidationSpecificationSource value) { return value == (source & value); }
/// <summary> /// Create a new instance of <see cref="ValidatorResolver"/> with the given /// parameters. /// </summary> /// <param name="ruleSet">Rule set name, or null to use default.</param> /// <param name="validationSource"><see cref="ValidationSpecificationSource"/> to use when resolving.</param> /// <param name="validatorType">Type of validator to resolve.</param> public ValidatorResolver(string ruleSet, ValidationSpecificationSource validationSource, Type validatorType) { this.ruleSet = ruleSet; this.validationSource = validationSource; this.validatorType = validatorType; }
/// <summary> /// Create a new instance of <see cref="InjectionValidationSource"/>, specifying /// the validation source. /// </summary> /// <param name="source">Source of validation metadata.</param> public InjectionValidationSource(ValidationSpecificationSource source) { Source = source; }
/// <summary> /// Resolve a validator with the given ruleset and validation source. /// </summary> /// <param name="typeToValidate">Type to construct a validator for.</param> /// <param name="ruleSet">Ruleset to use, or null for the default.</param> /// <param name="validationSource"><see cref="ValidationSpecificationSource"/> controlling which /// set of validator to retrieve.</param> public ValidatorParameter(Type typeToValidate, string ruleSet, ValidationSpecificationSource validationSource) { validatorType = typeof (Validator<>).MakeGenericType(typeToValidate); this.ruleSet = ruleSet; this.validationSource = validationSource; }
/// <summary> /// Creates the <see cref="ValidatorParameter"/> object which resolves /// using the default rule set and the given <paramref name="validationSource"/>. /// </summary> /// <param name="typeToValidate">Type to construct a validator for.</param> /// <param name="validationSource"><see cref="ValidationSpecificationSource"/> controlling which /// set of validator to retrieve.</param> public ValidatorParameter(Type typeToValidate, ValidationSpecificationSource validationSource) : this(typeToValidate, null, validationSource) { }