예제 #1
0
        // This method will never return null.
        internal static ExecutionContextScopeManager GetExecutionContextScopeManager(this Container container)
        {
            var manager = (ExecutionContextScopeManager)container.GetItem(ManagerKey);

            if (manager == null)
            {
                lock (ManagerKey)
                {
                    manager = (ExecutionContextScopeManager)container.GetItem(ManagerKey);

                    if (manager == null)
                    {
                        manager = new ExecutionContextScopeManager();
                        container.SetItem(ManagerKey, manager);
                    }
                }
            }

            return(manager);
        }
        // This method will never return null.
        internal static ExecutionContextScopeManager GetExecutionContextScopeManager(this Container container)
        {
            var manager = (ExecutionContextScopeManager)container.GetItem(ManagerKey);

            if (manager == null)
            {
                lock (ManagerKey)
                {
                    manager = (ExecutionContextScopeManager)container.GetItem(ManagerKey);

                    if (manager == null)
                    {
                        manager = new ExecutionContextScopeManager();
                        container.SetItem(ManagerKey, manager);
                    }
                }
            }

            return manager;
        }