public override PropertyConstraintViolationError Validate(object value, PropertyDefinition propertyDefinition, IPropertyBag propertyBag) { if (value != null) { try { if (this.validationType == LocalLongFullPathLengthConstraint.LocalLongFullPathLengthValidationType.Directory) { ((LocalLongFullPath)value).ValidateDirectoryPathLength(); } else { ((LocalLongFullPath)value).ValidateFilePathLength(); } } catch (FormatException ex) { return(new PropertyConstraintViolationError(DataStrings.ConstraintViolationPathLength(value.ToString(), ex.Message), propertyDefinition, value, this)); } } return(null); }