Пример #1
0
        internal RuleResult Process()
        {
            var result  = RuleResult.Default();
            var skipped = BeforeExecute();

            var executedContext = new RuleExecutedContext(false, RuleResult.Default());

            if (skipped)
            {
                executedContext = new RuleExecutedContext(false, RuleResult.Default());
                try
                {
                    result = Execute();
                }
                catch (Exception e)
                {
                    executedContext = new RuleExecutedContext(false, RuleResult.Default());
                    executedContext.SetException(e);
                }
            }
            AfterExecute(executedContext);
            return(result);
        }
Пример #2
0
 /// <summary>
 /// Get's called after executing rule.
 /// </summary>
 /// <param name="context">contains the rule execution result and other connected factors.</param>
 public virtual void AfterExecute(RuleExecutedContext context)
 {
 }