public IEnumerable Validate()

in src/Azure.Deployments.Extensibility.Core/V2/Validation/PropertyRule.cs [22:48]


        public IEnumerable<ErrorDetail> Validate(TModel model)
        {
            if (this.criteria.Count == 0)
            {
                yield break;
            }

            var property = this.propertyExpression.Compile().Invoke(model);
            var propertyPointer = this.CreatePropertyPointer();

            foreach (var criterion in this.criteria)
            {
                var criterionSatisfied = true;

                foreach (var errorDetail in criterion.Evaluate(model, property, propertyPointer))
                {
                    criterionSatisfied = false;
                    yield return errorDetail;
                }

                if (!criterionSatisfied)
                {
                    // Do not evaluate the next statement if the current one is not satisfied.
                    yield break;
                }
            }
        }