public static void Start(ActivityScope scope) { ActivityScope parent = ActivityStack.Count > 0 ? ActivityStack.Peek() : null; if (parent != null) { scope.ParentId = parent.Id; } ActivityStack.Push(scope); }
public static void Start(ActivityScope scope) { var parent = ActivityStack.Any() ? ActivityStack.Peek() : null; if (parent != null) { scope.ParentId = parent.Id; } ActivityStack = ActivityStack.Push(scope); }
public static void End(ActivityScope scope) { if (Current == null) { return; } if (!ActivityStack.Any(scopeOnTheStack => scope.Id == scopeOnTheStack.Id)) { return; } ActivityScope currentScope = ActivityStack.Pop(); while (ActivityStack.Count > 0 && currentScope.Id != scope.Id) { currentScope = ActivityStack.Pop(); } }
public static void End(ActivityScope scope) { if (Current == null) { return; } if (ActivityStack.All(scopeOnTheStack => scope.Id != scopeOnTheStack.Id)) { return; } ActivityScope currentScope; ActivityStack = ActivityStack.Pop(out currentScope); while (ActivityStack.Any() && currentScope.Id != scope.Id) { ActivityStack = ActivityStack.Pop(out currentScope); } }