Example #1
0
 public void Add(ObjectRequirementException exception)
 {
     foreach (var error in exception.Errors)
     {
         foreach (var type in error.Value)
         {
             Add(error.Key, type);
         }
     }
 }
Example #2
0
        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;
            } 
        }