public Evaluate ( Condition condition, object dataContext ) : bool | ||
condition | Condition | |
dataContext | object | |
return | bool |
public bool Evaluate(Condition condition, object dataContext)
{
// Empty condition always pass
if (String.IsNullOrWhiteSpace(condition.Expression))
{
return true;
}
if (condition.Type == ConditionType.Include)
{
return Evaluate(condition.Expression, dataContext);
}
else
{
return Evaluate(condition.Expression, dataContext) == false;
}
}
public override IEnumerable<ConfiguredActivity> Execute(object dataContext) { var evaluator = new ConditionEvaluator(); var success = evaluator.Evaluate(Conditions, dataContext); if (success) { return Further(Then, dataContext); } else { return Further(Else, dataContext); } }