public override void Validate(Element element, PropertyInfo property, object value) { if (value == null) { throw new ValidationException(string.Format("Missing argument {0} for {1}!", property.Name, element.Name)); } }
public override void Validate(Element element, PropertyInfo property, object value) { if (property.PropertyType != typeof(string)) { throw new ValidationWrongTypeException(string.Format("The {0} can only be used on {1} properties", GetType().Name, "string")); } if (!AllowEmpty) { if (string.IsNullOrEmpty((string)value)) { throw new ValidationException(string.Format("Argument {0} for {1} can't be empty!", property.Name, element.Name)); } } }
protected void BeginElement(Element element) { Runner.BeginElement(element); }
public abstract void Validate(Element element, PropertyInfo property, object value);
internal void BeginElement(Element element) { Parents.Push(element); }