Ejemplo n.º 1
0
        /// <summary>
        /// Close all db context
        /// </summary>
        public static void CloseAllDbContext(IDALContainer dalContainer)
        {
            HttpContext context = HttpContext.Current;

            if (context != null && context.Session != null)
            {
                EFDbContextStorage ctxStorage = context.Session[STORAGE_KEY] as EFDbContextStorage;

                if (ctxStorage != null)
                {
                    foreach (EFDbContext ctx in ctxStorage.GetAllDbContexts())
                    {
                        if (ctx.Database.Connection.State == System.Data.ConnectionState.Open)
                        {
                            ctx.Database.Connection.Close();
                        }

                        ctx.Dispose();
                    }

                    context.Session.Remove(STORAGE_KEY);
                }
            }
            else if (dalContainer != null)
            {
                dalContainer.Close();
                dalContainer.Dispose();
            }
        }
Ejemplo n.º 2
0
 protected override void Dispose(bool disposing)
 {
     if (DALContainer != null)
     {
         DALContainer.Close();
         DALContainer.Dispose();
         DALContainer = null;
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 3
0
 public LVApiController()
 {
     DALContainer = new EFDALContainer();
     //language = GetLang();
     //userAccount = GetUserAccount();
 }
Ejemplo n.º 4
0
 public BaseController()
 {
     DALContainer    = new EFDALContainer();
     DALContainerLog = new EFDALContainer();
 }
Ejemplo n.º 5
0
 ISearchManager IManagerControler.getSearchManager(IDALContainer container)
 {
     return new SearchManager(container.GetWorkingContext() as NHibernate.ISession);
 }
Ejemplo n.º 6
0
 //ILivresManager IManagerControler.getMediaManager(IDALContainer container)
 //{
 //    return new LivresManager(container.GetWorkingContext() as NHibernate.ISession);
 //}
 IMediasManager IManagerControler.getMediaManager(IDALContainer container)
 {
     return new MediasManager(container.GetWorkingContext() as NHibernate.ISession);
 }
Ejemplo n.º 7
0
 //ICdsManager IManagerControler.getCdManager(IDALContainer container)
 //{
 //    return new CdsManager(container.GetWorkingContext() as NHibernate.ISession);
 //}
 IAuteursManager IManagerControler.getAuteurManager(IDALContainer container)
 {
     return new AuteurManager(container.GetWorkingContext() as NHibernate.ISession);
 }