public static void ObjectIsValid(StringProperty obj, ObjectIsValidEventArgs e) { if (obj.GetLengthConstraint() == null) { e.Errors.Add(string.Format("String property {0}.{1} must have a string range constraint", obj.ObjectClass.Name, obj.Name)); } }
public static int GetMaxLength(this StringProperty prop) { if (prop == null) { throw new ArgumentNullException("prop"); } StringRangeConstraint constraint = prop.GetLengthConstraint(); // create unconstrained maxLength if no constrain is specified return(constraint == null ? Zetbox.API.Helper.DefaultStringPropertyLength : (constraint.MaxLength ?? int.MaxValue)); }