/// <summary> /// The check property. /// </summary> /// <param name="statement"> /// The statement. /// </param> /// <param name="expression"> /// The expression. /// </param> public void CheckProperty(Statement statement, Expression <Func <Statement, object> > expression) { LogicalControlException ex = null; var checks = checkStatements.Where(x => x.Expression != null && x.Expression.ToString() == expression.ToString()); foreach (var checkStatement in checks) { try { if (checkStatement.CheckRequired) { checkStatement.CheckObject(statement); } } catch (LogicalControlException exception) { if (ex == null) { ex = exception; } else { ex.AddException(exception); } } } if (ex != null) { throw ex; } }
/// <summary> /// The check statement. /// </summary> /// <param name="statement"> /// The statement. /// </param> /// <param name="level"> /// The level. /// </param> public void CheckStatement(Statement statement, CheckLevelEnum level) { LogicalControlException ex = null; foreach (var checkStatement in checkStatements.Where(x => x.Level == level)) { try { if (checkStatement.CheckRequired) { checkStatement.CheckObject(statement); } } catch (LogicalControlException exception) { if (ex == null) { ex = exception; } else { ex.AddException(exception); } } } if (ex != null) { throw ex; } }