예제 #1
0
        public IDisposable BeginScopeImpl(object state)
        {
            var scope = new ElmScope(_name, state);

            scope.Context = ElmScope.Current?.Context ?? GetNewActivityContext();
            return(ElmScope.Push(scope, _store));
        }
예제 #2
0
        public static IDisposable Push([NotNull] ElmScope scope, [NotNull] ElmStore store)
        {
            var temp = Current;
            Current = scope;
            Current.Parent = temp;

            Current.Node = new ScopeNode()
            {
                StartTime = DateTimeOffset.UtcNow,
                State = Current._state,
                Name = Current._name
            };

            if (Current.Parent != null)
            {
                Current.Node.Parent = Current.Parent.Node;
                Current.Parent.Node.Children.Add(Current.Node);
            }
            else
            {
                Current.Context.Root = Current.Node;
                store.AddActivity(Current.Context);
            }

            return new DisposableAction(() =>
            {
                Current.Node.EndTime = DateTimeOffset.UtcNow;
                Current = Current.Parent;
            });
        }
예제 #3
0
        public static IDisposable Push([NotNull] ElmScope scope, [NotNull] ElmStore store)
        {
            var temp = Current;

            Current        = scope;
            Current.Parent = temp;

            Current.Node = new ScopeNode()
            {
                StartTime = DateTimeOffset.UtcNow,
                State     = Current._state,
                Name      = Current._name
            };

            if (Current.Parent != null)
            {
                Current.Node.Parent = Current.Parent.Node;
                Current.Parent.Node.Children.Add(Current.Node);
            }
            else
            {
                Current.Context.Root = Current.Node;
                store.AddActivity(Current.Context);
            }

            return(new DisposableAction(() =>
            {
                Current.Node.EndTime = DateTimeOffset.UtcNow;
                Current = Current.Parent;
            }));
        }
예제 #4
0
 public IDisposable BeginScopeImpl(object state)
 {
     var scope = new ElmScope(_name, state);
     scope.Context = ElmScope.Current?.Context ?? GetNewActivityContext();
     return ElmScope.Push(scope, _store);
 }