Пример #1
0
        public override void Validate(string fieldName, ContentFieldOptions options, ValidationContext context)
        {
            IntegerFieldOptions fieldOptions = (IntegerFieldOptions)options;

            if (fieldOptions.IsRequired && HasValue == false)
            {
                context.AddRequireValidation(fieldName);
            }
        }
Пример #2
0
        public static TContentSchema AddInteger <TContentSchema>(this TContentSchema schema, string name, Action <IntegerFieldOptions>?configOptions = null)
            where TContentSchema : IContentSchema
        {
            IntegerFieldOptions options = new IntegerFieldOptions();

            configOptions?.Invoke(options);

            schema.AddField <IntegerField>(name, options, null);

            return(schema);
        }