public static ArrayFieldOptions GetArrayFieldOptions(this ContentSchemaField schemaField) { ArrayFieldOptions?options = (ArrayFieldOptions?)schemaField.Options; if (options == null) { throw new Exception(); } return(options); }
public static IEnumerable <ValidationError> Validate(this ContentItem contentItem) { List <ValidationError> result = new List <ValidationError>(); foreach (var field in contentItem.Fields) { ContentSchemaField f = contentItem.Schema.Fields[field.Key]; ValidationContext validationContext = new ValidationContext(); field.Value.Validate(field.Key, f.Options, validationContext); return(validationContext.Errors); } return(result); }