示例#1
0
        /// <summary>
        /// Load this configuratin from xml element.
        /// </summary>
        /// <param name="xmlElement"></param>
        /// <param name="logger"></param>
        public void Load(XmlElement xmlElement, TraceLogger logger)
        {
            bool found = false;

            foreach (XmlNode node in xmlElement.ChildNodes)
            {
                found = true;
                var config = GrainTypeConfiguration.Load((XmlElement)node, logger);
                if (null == config)
                {
                    continue;
                }

                if (config.AreDefaults)
                {
                    defaults = config;
                }
                else
                {
                    if (classSpecific.ContainsKey(config.Type.FullName))
                    {
                        throw new InvalidOperationException(string.Format("duplicate type {0} in configuration", config.Type.FullName));
                    }
                    classSpecific.Add(config.Type.FullName, config);
                }
            }

            if (!found)
            {
                throw new InvalidOperationException("empty GrainTypeConfiguration element");
            }
        }