示例#1
0
        private static string BuildMessage(ValidationFailures validationFailures)
        {
            if (validationFailures.Count == 1)
            {
                return(validationFailures.First().Message);
            }

            var errors = string.Join(", ", validationFailures.Select(v => v.Message));

            return($"Domain validation failed with errors: {errors}");
        }
示例#2
0
 public DomainRuleException(ValidationFailures validationFailures) : base(BuildMessage(validationFailures))
 {
     ValidationFailures = validationFailures;
 }
示例#3
0
 public DomainRuleException(string name, string message) : base(message)
 {
     ValidationFailures.Add(new ValidationFailure(name, message));
 }