public void Dispose() { if (ThreadData.Contains(Key)) { var stack = ThreadData.GetClass <Stack <string> >(Key); stack.Pop(); ThreadData.SetValue(Key, stack); } }
public DepthCheck(int maxDepth, Type type) { Stack <string> stack = new Stack <string>(); if (ThreadData.Contains(Key)) { stack = ThreadData.GetClass <Stack <string> >(Key); } stack.Push(type.FullName); if (stack.Count > maxDepth) { throw new MapperStackException(Constants.Errors.LazyLoop.Formatted( stack.Aggregate((x, y) => "{0}{1}\n\r".Formatted(x, y)) )); } ThreadData.SetValue(Key, stack); }