Ejemplo n.º 1
0
 private static Boolean CheckCondition(Func <ObjectInstance, Boolean> condition, ObjectInstance oi)
 {
     if (condition == null)
     {
         return(true);
     }
     else
     {
         try
         {
             return(condition(oi));
         }
         //if the condition is dependent on another field which is also invalid, it will fail.
         catch (Exception ex)
         {
             //update - this is incomplete: We should find a way to save that this happened, let the rest of the validation continue, but then check to see if this condition exists an throw a real error
             if (Debugger.IsAttached)
             {
                 Debug.WriteLine("Rule '{0}' not applied - condition invalid with exception:");
                 Debug.WriteLine(ex);
             }
             throw;
         }
     }
 }
Ejemplo n.º 2
0
 internal RuleViolation(Rule appliedRule, ObjectInstance oi)
 {
     AppliedRule   = appliedRule;
     InvalidObject = oi;
 }
Ejemplo n.º 3
0
 public RuleViolationFromException(Rule appliedRule, ObjectInstance oi, Exception ex) : base(appliedRule, oi)
 {
     CaughtException = ex;
 }