Esempio n. 1
0
        /// <summary>
        /// Private method that parses the configuration XML and creates the ConfigCollections that reprent that
        /// configuration.  This is used to store the entire set of collections in memory once and have clones
        /// sent out whenever they are requested.
        /// </summary>
        private void InitializeConfigurations()
        {
            XmlNodeList nodeList;
            IConfigurationCollection list   = null;
            IConfiguration           config = null;

            m_configurations.Clear();

            const string xpathVal = "//rule";

            nodeList = m_masterDoc.SelectNodes(xpathVal);

            try
            {
                foreach (XmlNode ruleNode in nodeList)
                {
                    config = new ConfigurationData(ruleNode);
                    list   = new ConfigurationCollection();
                    m_configurations.Add("ItemPrice", list);
                    list.AddConfiguration(config);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Error occured while initializing the configuration in ConfigurationSet.InitializeConfigurations method : {0}", ex.Message));
            }
        }
        /// <summary>
        /// Implemets the <see cref="ICloneable"/> interface.
        /// </summary>
        /// <returns>A clone of the collection with clones of the configurations as well.</returns>
        public Object Clone()
        {
            IConfigurationCollection newCollection;

            newCollection = new ConfigurationCollection();

            foreach (string key in m_Configurations.Keys)
            {
                IConfiguration config = m_Configurations[key] as IConfiguration;
                newCollection.AddConfiguration(config.Clone() as IConfiguration);
            }

            return(newCollection);
        }
        /// <summary>
        /// Implemets the <see cref="ICloneable"/> interface.
        /// </summary>
        /// <returns>A clone of the collection with clones of the configurations as well.</returns>
        public Object Clone()
        {
            IConfigurationCollection newCollection;

            newCollection = new ConfigurationCollection();

            foreach(string key in m_Configurations.Keys)
            {
                IConfiguration config = m_Configurations[key] as IConfiguration;
                newCollection.AddConfiguration(config.Clone() as IConfiguration);
            }

            return newCollection;
        }
        /// <summary>
        /// Private method that parses the configuration XML and creates the ConfigCollections that reprent that
        /// configuration.  This is used to store the entire set of collections in memory once and have clones
        /// sent out whenever they are requested.
        /// </summary>
        private void InitializeConfigurations()
        {
            XmlNodeList nodeList;
            IConfigurationCollection list = null;
            IConfiguration config = null;

            m_configurations.Clear();

            const string xpathVal = "//rule";
            nodeList = m_masterDoc.SelectNodes(xpathVal);

            try
            {
                foreach (XmlNode ruleNode in nodeList)
                {
                    config = new ConfigurationData(ruleNode);
                    list = new ConfigurationCollection();
                    m_configurations.Add("ItemPrice", list);
                    list.AddConfiguration(config);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Error occured while initializing the configuration in ConfigurationSet.InitializeConfigurations method : {0}", ex.Message));
            }
        }