public void Add(ObjectRequirementException exception) { foreach (var error in exception.Errors) { foreach (var type in error.Value) { Add(error.Key, type); } } }
public static void Throw(params IEnumerable<ObjectRequirementException>[] exceptions) { var aggregateException = new ObjectRequirementException(); foreach (var exceptionList in exceptions) { foreach (var exception in exceptionList) { aggregateException.Add(exception); } } if (aggregateException.Errors.Any()) { throw aggregateException; } }