/// <summary>
        /// Построить правила проверки для коллекции.
        /// </summary>
        public static IValidationOperator ForCollection(Action <CollectionCompositeValidationBuilder> buildAction)
        {
            var builder = new CollectionCompositeValidationBuilder();

            buildAction(builder);

            return(builder.Operator);
        }
예제 #2
0
        /// <summary>
        /// Добавить правило проверки коллекции текущего объекта.
        /// </summary>
        public ObjectValidationBuilder Collection(string property, Action <CollectionCompositeValidationBuilder> buildAction)
        {
            var builder = new CollectionCompositeValidationBuilder(property);

            buildAction(builder);

            _compositeValidator.Add(builder.Operator);

            return(this);
        }
        /// <summary>
        /// Добавить правило логического умножения для текущей коллекции.
        /// </summary>
        public CollectionValidationBuilder And(Action <CollectionValidationBuilder> buildAction)
        {
            var compositeValidationBuilder = new CollectionCompositeValidationBuilder();

            compositeValidationBuilder.And(buildAction);

            _compositeValidator.Add(compositeValidationBuilder.Operator);

            return(this);
        }