public async Task <ValidationResult> ProcessAsync(T value, ValidationContext context)
        {
            var result = await _member.ProcessAsync(value, context);

            if (!result.IsValid)
            {
                throw new ValidationStoppedException(result);
            }

            return(result);
        }
Exemple #2
0
        private static async Task <ValidationResult> ProcessRule <T>(
            T instance, IValidationChainMember <T> validationChainMember, Dictionary <RuleIdentity, ValidationResult> validationMap,
            ValidationResult result, ValidationContext context)
        {
            if (validationMap.TryGetValue(validationChainMember.Identity, out var validationResult))
            {
                return(validationResult);
            }
            var res = await validationChainMember.ProcessAsync(instance, context);

            validationMap[validationChainMember.Identity] = res;
            result.MergeResult(res);
            return(res);
        }