protected void AddTrace(int id, string ruleId, string expression, string description, object value, bool push = false) { //if (!IncludeTrace) return; var info = new RuleBookTraceInformation(ruleId, expression, description, value) { Id = id, LoopContext = CurrentLoopContext, ContextId = CurrentContextId }; if (push) { CurrentTraceInfo.TraceInformation.Add(info); TraceInfoStack.Push(info); } else { CurrentTraceInfo.TraceInformation.Add(info); } }
protected void Traverse(RuleBookTraceInformation parent, Action<RuleBookTraceInformation> action) { foreach (var child in parent.TraceInformation) { action(child); child.Traverse(child, action); } }
public void Initialize() { Result = new RuleBookResult(); TraceInfoStack = new Stack<RuleBookTraceInformation>(); LoopContextStack = new Stack<string>(); ContextIdStack = new Stack<string>(); CurrentLoopItemStack = new Stack<IDictionary<string, object>>(); ResultItemsStack = new Stack<IDictionary<string, object>>(); var rootTrace = new RuleBookTraceInformation(string.Empty, "", "Root", true); Result.TraceInformation.Add(rootTrace); TraceInfoStack.Push(rootTrace); }