コード例 #1
0
        /// <inheritdoc />
        protected override void PostDeserialize()
        {
            base.PostDeserialize();

            foreach (PropertyConfigurationElementBase propertyConfig in this.ImplementationProperties)
            {
                ValuePropertyConfigurationElement valueConfig = propertyConfig as ValuePropertyConfigurationElement;

                if (valueConfig != null)
                {
                    valueConfig.ConvertValue(this.ImplementationType);
                }

                ResolvePropertyConfigurationElement dependencyConfig = propertyConfig as ResolvePropertyConfigurationElement;

                if (dependencyConfig != null)
                {
                    dependencyConfig.ResolveDependencyType(this.ImplementationType);
                }

                CollectionPropertyConfigurationElement collectionConfig = propertyConfig as CollectionPropertyConfigurationElement;

                if ((collectionConfig != null) && (collectionConfig.ResolveType == CollectionPropertyConfigurationElement.CollectionResolveType.Values))
                {
                    collectionConfig.Validate(this.ImplementationType);

                    foreach (CollectionPropertyValueConfigurationElement config in collectionConfig.Values)
                    {
                        config.ConvertValue(collectionConfig.CollectionElementType);
                    }
                }
            }
        }
        protected override bool OnDeserializeUnrecognizedElement(string elementName, XmlReader reader)
        {
            PropertyConfigurationElementBase element;

            switch (elementName)
            {
            case "set":
                element = new ValuePropertyConfigurationElement();

                break;

            case "dependency":
                element = new ResolvePropertyConfigurationElement();

                break;

            case "collection":
                element = new CollectionPropertyConfigurationElement();

                break;

            default:
                return(false);
            }

            element.DeserializeElementInternal(reader);

            this.BaseAdd(element);

            return(true);
        }