コード例 #1
0
        internal void UpdateEndpointSections(ContextInformation evaluationContext)
        {
            ExtensionElementCollection endpointExtensions = ExtensionsSection.UnsafeLookupCollection(ConfigurationStrings.EndpointExtensions, evaluationContext);

            // Extension collections are additive only (BasicMap) and do not allow for <clear>
            // or <remove> tags, nor do they allow for overriding an entry.  This allows us
            // to optimize this to only walk the binding extension collection if the counts
            // mismatch.
            if (endpointExtensions.Count != this.properties.Count)
            {
                foreach (ExtensionElement endpointExtension in endpointExtensions)
                {
                    if (null != endpointExtension)
                    {
                        if (!this.properties.Contains(endpointExtension.Name))
                        {
                            Type extensionType = Type.GetType(endpointExtension.Type, false);
                            if (extensionType == null)
                            {
                                ConfigurationHelpers.TraceExtensionTypeNotFound(endpointExtension);
                            }
                            else
                            {
                                ConfigurationProperty property = new ConfigurationProperty(endpointExtension.Name,
                                                                                           extensionType,
                                                                                           null,
                                                                                           ConfigurationPropertyOptions.None);

                                this.properties.Add(property);
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
        internal void UpdateEndpointSections(ContextInformation evaluationContext)
        {
            ExtensionElementCollection elements = ExtensionsSection.UnsafeLookupCollection("endpointExtensions", evaluationContext);

            if (elements.Count != this.properties.Count)
            {
                foreach (ExtensionElement element in elements)
                {
                    if ((element != null) && !this.properties.Contains(element.Name))
                    {
                        Type type = Type.GetType(element.Type, false);
                        if (type == null)
                        {
                            ConfigurationHelpers.TraceExtensionTypeNotFound(element);
                        }
                        else
                        {
                            ConfigurationProperty property = new ConfigurationProperty(element.Name, type, null, ConfigurationPropertyOptions.None);
                            this.properties.Add(property);
                        }
                    }
                }
            }
        }