コード例 #1
0
        public static TestCoreFrameEntities GetDbContext()
        {
            TestCoreFrameEntities DbContext = HttpContext.Current.Items["DbContext"] as TestCoreFrameEntities;

            if (DbContext == null)
            {
                DbContext = new TestCoreFrameEntities();
                HttpContext.Current.Items["DbContext"] = DbContext;
            }

            return(DbContext);
        }
コード例 #2
0
        public static void DisposeDbContext()
        {
            if (HttpContext.Current == null)
            {
                return;
            }

            if (HttpContext.Current.Items == null)
            {
                return;
            }

            TestCoreFrameEntities DbContext = HttpContext.Current.Items["DbContext"] as TestCoreFrameEntities;

            if (DbContext != null)
            {
                DbContext.Dispose();
            }
        }
コード例 #3
0
        //public static StackTrace stackTrace = new StackTrace(ex, true);
        //protected static string grandParentFunction = stackTrace.GetFrames().LastOrDefault().GetMethod().Name;
        //protected string grandParentFunction = new StackFrame(1, true).GetMethod().Name;

        public ModuleManager()
        {
            this.DBContext = TestCoreFrameDBEntities.GetDbContext();
            module         = DBContext.Set <T>();
        }