public PaskolDbContext GetDataContext()
        {
            PaskolDbContext objectContext = null;

            if (HttpContext.Current.Items.Contains(_dataContextKey))
            {
                objectContext =
                    (PaskolDbContext)HttpContext.Current.Items[_dataContextKey];
            }
            return(objectContext);
        }
 public void Store(PaskolDbContext pasloDb)
 {
     if (HttpContext.Current.Items.Contains(_dataContextKey))
     {
         HttpContext.Current.Items[_dataContextKey] = pasloDb;
     }
     else
     {
         HttpContext.Current.Items.Add(_dataContextKey, pasloDb);
     }
 }
Ejemplo n.º 3
0
        public static PaskolDbContext GetDataContext()
        {
            HttpDataContextStorageContainer _dataContextStorageContainer = new HttpDataContextStorageContainer();
            PaskolDbContext paskolDb =
                _dataContextStorageContainer.GetDataContext();

            if (paskolDb == null)
            {
                paskolDb = new PaskolDbContext();
                _dataContextStorageContainer.Store(paskolDb);
            }

            return(paskolDb);
        }