}         // end of create

        /// <summary>
        /// Create the Bag according to what is available. First use Cookies,
        /// then try Session and then fallback to Application.
        /// </summary>
        /// <param name="bag_type">The bag_type.</param>
        /// <returns></returns>
        public IWebBagHolder create(BagFactoryType bag_type)
        {
            // application type
            if (bag_type == BagFactoryType.ApplicationType)
            {
                // get the appli. bag
                return(new ApplicationBag());
            }

            // session type
            else if (bag_type == BagFactoryType.SessionType &&
                     // if session is not available, then use the default
                     HttpContext.Current.Session != null)
            {
                return(new SessionBag());
            }

            // cookie type
            else if (bag_type == BagFactoryType.CookieType)
            {
                return(new CookieBag());
            }
            // get the default bag
            return(new ApplicationBag());
        }         // end of create
Esempio n. 2
0
        /// <summary>
        /// Create the Bag according to what is available. First use Cookies,
        ///     then try Session and then fallback to Application.
        /// </summary>
        /// <param name="bagType">
        /// The bag_type.
        /// </param>
        /// <returns>
        /// </returns>
        public IWebBagHolder create(BagFactoryType bagType)
        {
            // application type
            if (bagType == BagFactoryType.ApplicationType)
            {
                // get the appli. bag
                return new ApplicationBag();
            }

            if (bagType == BagFactoryType.SessionType && // if session is not available, then use the default
                     HttpContext.Current.Session != null)
            {
                // session type
                return new SessionBag();
            }

            if (bagType == BagFactoryType.CookieType)
            {
                // cookie type
                return new CookieBag();
            }

            // get the default bag
            return new ApplicationBag();
        }