示例#1
0
        /// <summary>
        /// Manages caching of the Resource Sets. Once loaded the values are loaded from the
        /// cache only.
        /// </summary>
        /// <param name="cultureName"></param>
        /// <returns></returns>
        private IDictionary GetResourceCache(string cultureName)
        {
            if (cultureName == null)
            {
                cultureName = "";
            }

            if (this._resourceCache == null)
            {
                this._resourceCache = new ListDictionary();
            }

            IDictionary Resources = this._resourceCache[cultureName] as IDictionary;

            if (Resources == null)
            {
                // *** DEPENDENCY HERE (#1): Using wwDbResourceDataManager to retrieve resources

                // *** Use datamanager to retrieve the resource keys from the database
                wwDbResourceDataManager Data = new wwDbResourceDataManager();
                Resources = Data.GetResourceSet(cultureName as string, this._ResourceSetName);
                this._resourceCache[cultureName] = Resources;
            }

            return(Resources);
        }
            private void Load()
            {
                // *** RAS Modified: Read the full page path ie. /internationalization/test.aspx
                string ResourceSet = GetFullPagePath();

                // *** Load IDictionary data using the DataManager (same code as provider)
                wwDbResourceDataManager Manager = new wwDbResourceDataManager();

                this._reader = Manager.GetResourceSet("", ResourceSet);
            }
示例#3
0
        /// <summary>
        /// This is the worker method responsible for actually retrieving resources from the resource
        /// store. This method goes out queries the database by asking for a specific ResourceSet and
        /// Culture and it returns a Hashtable (as IEnumerable) to use as a ResourceSet.
        ///
        /// The ResourceSet manages access to resources via IEnumerable access which is ultimately used
        /// to return resources to the front end.
        ///
        /// Resources are read once and cached into an internal Items field. A ResourceReader instance
        /// is specific to a ResourceSet and Culture combination so there should never be a need to
        /// reload this data, except when explicitly clearing the reader/resourceset (in which case
        /// Items can be set to null via ClearResources()).
        /// </summary>
        /// <returns>An IDictionaryEnumerator of the resources for this reader</returns>
        public IDictionaryEnumerator GetEnumerator()
        {
            if (this.Items != null)
            {
                return(this.Items.GetEnumerator());
            }

            // *** DEPENDENCY HERE
            // *** Here's the only place we really access the database and return
            // *** a specific ResourceSet for a given ResourceSet Id and Culture
            wwDbResourceDataManager Manager = new wwDbResourceDataManager();

            this.Items = Manager.GetResourceSet(this.cultureInfo.Name, this.baseNameField);
            return(this.Items.GetEnumerator());
        }