public override PropertyConstraintViolationError Validate(object value, PropertyDefinition propertyDefinition, IPropertyBag propertyBag)
        {
            IPRange iprange = value as IPRange;

            if (iprange != null && (iprange.LowerBound.AddressFamily == AddressFamily.InterNetworkV6 || iprange.UpperBound.AddressFamily == AddressFamily.InterNetworkV6))
            {
                return(new PropertyConstraintViolationError(DataStrings.ConstraintViolationIpV6NotAllowed(iprange.ToString()), propertyDefinition, value, this));
            }
            return(null);
        }
예제 #2
0
        public override PropertyConstraintViolationError Validate(object value, PropertyDefinition propertyDefinition, IPropertyBag propertyBag)
        {
            IPvxAddress pvxAddress = new IPvxAddress(0UL, this.maxIPRange);
            IPRange     iprange    = value as IPRange;

            if (iprange != null && pvxAddress.CompareTo(iprange.Size) < 0)
            {
                return(new PropertyConstraintViolationError(DataStrings.ConstraintViolationIpRangeNotAllowed(iprange.ToString(), this.maxIPRange), propertyDefinition, value, this));
            }
            return(null);
        }