internal static ExtensionElementCollection LookupCollection(string collectionName, ContextInformation evaluationContext)
        {
            ExtensionsSection associatedSection = null;

            if (evaluationContext != null)
            {
                associatedSection = (ExtensionsSection)ConfigurationHelpers.GetAssociatedSection(evaluationContext, ConfigurationStrings.ExtensionsSectionPath);
            }
            else
            {
                if (DiagnosticUtility.ShouldTraceWarning)
                {
                    TraceUtility.TraceEvent(TraceEventType.Warning, 0x80018, System.ServiceModel.SR.GetString("TraceCodeEvaluationContextNotFound"), null, (Exception)null);
                }
                associatedSection = (ExtensionsSection)ConfigurationHelpers.GetSection(ConfigurationStrings.ExtensionsSectionPath);
            }
            switch (collectionName)
            {
            case "behaviorExtensions":
                return(associatedSection.BehaviorExtensions);

            case "bindingElementExtensions":
                return(associatedSection.BindingElementExtensions);

            case "bindingExtensions":
                return(associatedSection.BindingExtensions);

            case "endpointExtensions":
                return(associatedSection.EndpointExtensions);
            }
            DiagnosticUtility.FailFast(string.Format(CultureInfo.InvariantCulture, "{0} is not a valid ServiceModelExtensionsSection collection name.", new object[] { collectionName }));
            return(null);
        }
        /// Be sure to update UnsafeLookupCollection if you modify this method
        internal static ExtensionElementCollection LookupCollection(string collectionName, ContextInformation evaluationContext)
        {
            ExtensionElementCollection collection        = null;
            ExtensionsSection          extensionsSection = null;

            if (null != evaluationContext)
            {
                extensionsSection = (ExtensionsSection)ConfigurationHelpers.GetAssociatedSection(evaluationContext, ConfigurationStrings.ExtensionsSectionPath);
            }
            else
            {
                if (DiagnosticUtility.ShouldTraceWarning)
                {
                    TraceUtility.TraceEvent(TraceEventType.Warning,
                                            TraceCode.EvaluationContextNotFound,
                                            SR.GetString(SR.TraceCodeEvaluationContextNotFound),
                                            null,
                                            (Exception)null);
                }

                extensionsSection = (ExtensionsSection)ConfigurationHelpers.GetSection(ConfigurationStrings.ExtensionsSectionPath);
            }

            switch (collectionName)
            {
            case (ConfigurationStrings.BehaviorExtensions):
                collection = extensionsSection.BehaviorExtensions;
                break;

            case (ConfigurationStrings.BindingElementExtensions):
                collection = extensionsSection.BindingElementExtensions;
                break;

            case (ConfigurationStrings.BindingExtensions):
                collection = extensionsSection.BindingExtensions;
                break;

            case (ConfigurationStrings.EndpointExtensions):
                collection = extensionsSection.EndpointExtensions;
                break;

            default:
                // LookupCollection built on assumption that collectionName is valid.
                // This should be protected at the callers site.  If assumption is invalid, then
                // configuration system is in an indeterminate state.  Need to stop in a manner that
                // user code can not capture.
                Fx.Assert(String.Format(CultureInfo.InvariantCulture, "{0} is not a valid ServiceModelExtensionsSection collection name.", collectionName));
                DiagnosticUtility.FailFast(String.Format(CultureInfo.InvariantCulture, "{0} is not a valid ServiceModelExtensionsSection collection name.", collectionName));
                break;
            }

            return(collection);
        }
Ejemplo n.º 3
0
 internal static ServiceHostingEnvironmentSection GetSection()
 {
     return((ServiceHostingEnvironmentSection)ConfigurationHelpers.GetSection(ConfigurationStrings.ServiceHostingEnvironmentSectionPath));
 }
 internal static ServicesSection GetSection()
 {
     return((ServicesSection)ConfigurationHelpers.GetSection(ConfigurationStrings.ServicesSectionPath));
 }
Ejemplo n.º 5
0
 internal static DiagnosticSection GetSection()
 {
     return((DiagnosticSection)ConfigurationHelpers.GetSection(ConfigurationStrings.DiagnosticSectionPath));
 }
 internal static CommonBehaviorsSection GetSection()
 {
     return((CommonBehaviorsSection)ConfigurationHelpers.GetSection(ConfigurationStrings.CommonBehaviorsSectionPath));
 }
Ejemplo n.º 7
0
 internal static ClientSection GetSection()
 {
     return((ClientSection)ConfigurationHelpers.GetSection(ConfigurationStrings.ClientSectionPath));
 }
 internal static ProtocolMappingSection GetSection()
 {
     return((ProtocolMappingSection)ConfigurationHelpers.GetSection(ConfigurationStrings.ProtocolMappingSectionPath));
 }
 internal static ComContractsSection GetSection()
 {
     return((ComContractsSection)ConfigurationHelpers.GetSection(ConfigurationStrings.ComContractsSectionPath));
 }