Exemplo n.º 1
0
        private ValidationResult GetValidationResultFromRuleViolation(string prefix, RuleViolation error)
        {
            var name    = GetPropertyName(prefix, error);
            var members = new[] { name };

            return(new ValidationResult(error.Message, members));
        }
Exemplo n.º 2
0
        private string GetPropertyName(string prefix, RuleViolation error)
        {
            if (error.Property != null)
            {
                var name = GetPropertyName(error.Property);
                return(string.IsNullOrEmpty(name) ? "" : prefix + name);
            }

            if (error.PropertyName != null)
            {
                return(error.PropertyName);
            }

            return("");
        }