예제 #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);
        }
예제 #2
0
 // ===============================================================================
 //                                                                  Context Helper
 //                                                                  ==============
 protected void InitializeContext()
 {
     if (ConditionBeanContext.IsExistConditionBeanOnThread() ||
         OutsideSqlContext.IsExistOutsideSqlContextOnThread() ||
         FetchNarrowingBeanContext.IsExistFetchNarrowingBeanOnThread() ||
         InternalMapContext.IsExistInternalMapOnThread())      // means recursive invoking
     {
         SaveAllContextOnThread();
     }
     ClearAllCurrentContext();
 }
예제 #3
0
 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();
 }
예제 #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();
     }
 }