Esempio n. 1
0
        public static void SaveAllContextOnThread()
        {
            if (!IsExistContextStackOnThread())
            {
                Thread.SetData(_slot, new Stack <ContextStack>());
            }
            ContextStack contextStack = new ContextStack();

            if (ConditionBeanContext.IsExistConditionBeanOnThread())
            {
                contextStack.ConditionBean = ConditionBeanContext.GetConditionBeanOnThread();
            }
            if (OutsideSqlContext.IsExistOutsideSqlContextOnThread())
            {
                contextStack.OutsideSqlContext = OutsideSqlContext.GetOutsideSqlContextOnThread();
            }
            if (FetchNarrowingBeanContext.IsExistFetchNarrowingBeanOnThread())
            {
                contextStack.FetchNarrowingBean = FetchNarrowingBeanContext.GetFetchNarrowingBeanOnThread();
            }
            if (InternalMapContext.IsExistInternalMapOnThread())
            {
                contextStack.InternalMap = InternalMapContext.GetInternalMap();
            }
            GetContextStackOnThread().Push(contextStack);
        }
 // ===============================================================================
 //                                                                  Context Helper
 //                                                                  ==============
 protected void InitializeContext()
 {
     if (ConditionBeanContext.IsExistConditionBeanOnThread() ||
         OutsideSqlContext.IsExistOutsideSqlContextOnThread() ||
         FetchNarrowingBeanContext.IsExistFetchNarrowingBeanOnThread() ||
         InternalMapContext.IsExistInternalMapOnThread())      // means recursive invoking
     {
         SaveAllContextOnThread();
     }
     ClearAllCurrentContext();
 }
 protected void CloseContext()
 {
     if (FetchNarrowingBeanContext.IsExistFetchNarrowingBeanOnThread())
     {
         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
         // Because there is possible that fetch narrowing has been ignored for manualPaging of outsideSql.
         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
         FetchNarrowingBeanContext.GetFetchNarrowingBeanOnThread().RestoreIgnoredFetchNarrowing();
     }
     ClearAllCurrentContext();
     RestoreAllContextOnThreadIfExists();
 }
Esempio n. 4
0
 public static void ClearAllCurrentContext()
 {
     if (ConditionBeanContext.IsExistConditionBeanOnThread())
     {
         ConditionBeanContext.ClearConditionBeanOnThread();
     }
     if (OutsideSqlContext.IsExistOutsideSqlContextOnThread())
     {
         OutsideSqlContext.ClearOutsideSqlContextOnThread();
     }
     if (FetchNarrowingBeanContext.IsExistFetchNarrowingBeanOnThread())
     {
         FetchNarrowingBeanContext.ClearFetchNarrowingBeanOnThread();
     }
     if (InternalMapContext.IsExistInternalMapOnThread())
     {
         InternalMapContext.ClearInternalMapOnThread();
     }
 }