public ValidateMFRangeAttribute(RangeValidationType type, object min, object max, string errorMessage) : base(type, min, max, errorMessage) { MinObj = min; MaxObj = max; propType = "object"; }
public ValidateMFRangeAttribute(RangeValidationType type, object min, object max) : base(type, min, max) { MinObj = min; MaxObj = max; propType = "object"; }
/// <summary> /// Initializes an decimal-based range validator. /// </summary> /// <param name="min">The minimum value, or <c>decimal.MinValue</c> if this should not be tested.</param> /// <param name="max">The maximum value, or <c>decimal.MaxValue</c> if this should not be tested.</param> public RangeValidator(decimal min, decimal max) { AssertValid(max, min); type = RangeValidationType.Decimal; this.min = min; this.max = max; }
/// <summary> /// Initializes an long-based (<see cref="long"/>) range validator. /// </summary> /// <param name="min">The minimum value, or <c>long.MinValue</c> if this should not be tested.</param> /// <param name="max">The maximum value, or <c>long.MaxValue</c> if this should not be tested.</param> public RangeValidator(long min, long max) { AssertValid(max, min); type = RangeValidationType.Long; this.min = min; this.max = max; }
/// <summary> /// Initializes an integer-based range validator. /// </summary> /// <param name="min">The minimum value, or <c>int.MinValue</c> if this should not be tested.</param> /// <param name="max">The maximum value, or <c>int.MaxValue</c> if this should not be tested.</param> public RangeValidator(int min, int max) { AssertValid(max, min); type = RangeValidationType.Integer; this.min = min; this.max = max; }
/// <summary> /// Initializes a string-based range validator. /// </summary> /// <param name="min">The minimum value, or <c>String.Empty</c> if this should not be tested.</param> /// <param name="max">The maximum value, or <c>String.Empty</c> if this should not be tested.</param> public RangeValidator(string min, string max) { AssertValid(max, min); type = RangeValidationType.String; this.min = min; this.max = max; }
/// <summary> /// Initializes a DateTime-based range validator. /// </summary> /// <param name="min">The minimum value, or <c>DateTime.MinValue</c> if this should not be tested.</param> /// <param name="max">The maximum value, or <c>DateTime.MaxValue</c> if this should not be tested.</param> public RangeValidator(DateTime min, DateTime max) { AssertValid(max, min); type = RangeValidationType.DateTime; this.min = min; this.max = max; }
/// <summary> /// Initializes a range validator of the given type with the given minimum and maximum values. /// </summary> /// <param name="type">The type of range validator.</param> /// <param name="min">The minimum value, or <c>null</c> if this should not be tested.</param> /// <param name="max">The maximum value, or <c>null</c> if this should not be tested.</param> public RangeValidator(RangeValidationType type, object min, object max) { this.type = type; this.min = GetMinValue(min); this.max = GetMaxValue(max); }
/// <summary> /// Initializes a range validator of a specified type. /// </summary> /// <param name="type">The data type to be used by the range validator.</param> /// <param name="min">The minimum value, or <c>DateTime.MinValue</c> if this should not be tested.</param> /// <param name="max">The maximum value, or <c>DateTime.MaxValue</c> if this should not be tested.</param> /// <param name="errorMessage">The error message to be displayed if the validation fails.</param> public ValidateRangeAttribute(RangeValidationType type, object min, object max, string errorMessage) : base(errorMessage) { validator = new RangeValidator(type, min, max); }
/// <summary> /// Initializes a range validator of a specified type. /// </summary> /// <param name="type">The data type to be used by the range validator.</param> /// <param name="min">The minimum value, or <c>DateTime.MinValue</c> if this should not be tested.</param> /// <param name="max">The maximum value, or <c>DateTime.MaxValue</c> if this should not be tested.</param> public ValidateRangeAttribute(RangeValidationType type, object min, object max) : base() { validator = new RangeValidator(type, min, max); }