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); }
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(); } }
//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>(); }