Dev2.Providers.Validation.Rules.RuleSet.ValidateRules C# (CSharp) Method

ValidateRules() public method

public ValidateRules ( ) : List
return List
        public List<IActionableErrorInfo> ValidateRules()
        {
            var errors = from rule in Rules
                         let errorTO = rule.Check()
                         where errorTO != null
                         select errorTO;
            return errors.ToList();
        }

Same methods

RuleSet::ValidateRules ( string labelText, System.Action doError ) : List

Usage Example

        protected virtual string ValidatePath(string label, string path, Action onError, bool pathIsRequired)
        {
            if (!pathIsRequired && string.IsNullOrWhiteSpace(path))
            {
                return string.Empty;
            }

            var errors = new List<IActionableErrorInfo>();

            RuleSet fileActivityRuleSet = new RuleSet();
            IsValidExpressionRule isValidExpressionRule = new IsValidExpressionRule(() => path, DataListSingleton.ActiveDataList.Resource.DataList);
            fileActivityRuleSet.Add(isValidExpressionRule);
            errors.AddRange(fileActivityRuleSet.ValidateRules(label, onError));


            string pathValue;
            path.TryParseVariables(out pathValue, onError, variableValue: ValidUriSchemes[0] + "://temp");

            if (errors.Count == 0)
            {
                IsStringEmptyOrWhiteSpaceRule isStringEmptyOrWhiteSpaceRuleUserName = new IsStringEmptyOrWhiteSpaceRule(() => path)
                {
                    LabelText = label,
                    DoError = onError
                };

                IsValidFileNameRule isValidFileNameRule = new IsValidFileNameRule(() => path)
                {
                    LabelText = label,
                    DoError = onError
                };

                fileActivityRuleSet.Add(isStringEmptyOrWhiteSpaceRuleUserName);
                fileActivityRuleSet.Add(isValidExpressionRule);
                
                errors.AddRange(fileActivityRuleSet.ValidateRules(label, onError));

            }

            UpdateErrors(errors);
            return pathValue;
        }
All Usage Examples Of Dev2.Providers.Validation.Rules.RuleSet::ValidateRules