Пример #1
0
        public static ValidationHandleOperation HandleAll(this ValidationHandleOperation op, IValidationHandler handler)
        {
            op.CheckNull(nameof(op));
            handler.CheckNull(nameof(handler));

            op.Handle(handler);

            return(op);
        }
Пример #2
0
        public static ValidationHandleOperation HandleForFailure(this ValidationHandleOperation op, IValidationHandler handler)
        {
            op.CheckNull(nameof(op));
            handler.CheckNull(nameof(handler));

            op.Handle(handler, x => x.Where(y => !y.IsValid));

            return(op);
        }
Пример #3
0
        public static ValidationHandleOperation HandleForStrategy(this ValidationHandleOperation op, string name,
                                                                  IValidationHandler handler)
        {
            op.CheckNull(nameof(op));
            handler.CheckNull(nameof(handler));

            op.Handle(handler, name);

            return(op);
        }
Пример #4
0
        internal void Handle(IValidationHandler handler, string strategyName)
        {
            handler.CheckNull(nameof(handler));
            var coll = _collection.Filter(strategyName);

            if (coll == null)
            {
                return;
            }

            handler.Handle(coll);
        }
Пример #5
0
        internal void Handle(IValidationHandler handler, Action <IEnumerable <ValidationResult> > filterFunc = null)
        {
            handler.CheckNull(nameof(handler));
            var coll = filterFunc == null ? _collection : _collection.Filter(filterFunc);

            if (coll == null)
            {
                return;
            }

            handler.Handle(coll);
        }