Ejemplo n.º 1
0
        public bool TryGetErrors(TModel model, IExecutionContext executionContext, ValidationStrategy validationStrategy, int depth, out IErrorsCollection scopeErrorsCollection)
        {
            var errorsCollection = _getErrors(this, model, executionContext ?? throw new ArgumentNullException(nameof(executionContext)), validationStrategy, depth);

            if (!errorsCollection.IsEmpty && (RuleSingleError != null))
            {
                scopeErrorsCollection = ErrorsCollection.WithSingleOrNull(RuleSingleError);

                return(true);
            }

            scopeErrorsCollection = errorsCollection;

            return(!scopeErrorsCollection.IsEmpty);
        }
Ejemplo n.º 2
0
        public bool TryGetErrors(TModel model, IExecutionContext executionContext, ValidationStrategy validationStrategy, int depth, out IErrorsCollection scopeErrorsCollection)
        {
            var anyErrors = Rule.TryGetErrors(model, executionContext, validationStrategy, out var errorsCollection);

            if (!errorsCollection.IsEmpty && (RuleSingleError != null))
            {
                scopeErrorsCollection = ErrorsCollection.WithSingleOrNull(RuleSingleError);

                return(true);
            }

            scopeErrorsCollection = errorsCollection;

            return(anyErrors);
        }