예제 #1
0
        public static ArrayFieldOptions GetArrayFieldOptions(this ContentSchemaField schemaField)
        {
            ArrayFieldOptions?options = (ArrayFieldOptions?)schemaField.Options;

            if (options == null)
            {
                throw new Exception();
            }

            return(options);
        }
예제 #2
0
        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);
        }