internal static ExtensionElementCollection UnsafeLookupCollection(string collectionName, ContextInformation evaluationContext) { ExtensionsSection section = null; if (evaluationContext != null) { section = (ExtensionsSection)ConfigurationHelpers.UnsafeGetAssociatedSection(evaluationContext, ConfigurationStrings.ExtensionsSectionPath); } else { if (DiagnosticUtility.ShouldTraceWarning) { TraceUtility.TraceEvent(TraceEventType.Warning, 0x80018, System.ServiceModel.SR.GetString("TraceCodeEvaluationContextNotFound"), null, (Exception)null); } section = (ExtensionsSection)ConfigurationHelpers.UnsafeGetSection(ConfigurationStrings.ExtensionsSectionPath); } switch (collectionName) { case "behaviorExtensions": return(section.BehaviorExtensions); case "bindingElementExtensions": return(section.BindingElementExtensions); case "bindingExtensions": return(section.BindingExtensions); case "endpointExtensions": return(section.EndpointExtensions); } DiagnosticUtility.FailFast(string.Format(CultureInfo.InvariantCulture, "{0} is not a valid ServiceModelExtensionsSection collection name.", new object[] { collectionName })); return(null); }
internal static ExtensionElementCollection UnsafeLookupCollection(string collectionName, ContextInformation evaluationContext) { ExtensionElementCollection collection = null; ExtensionsSection extensionsSection = null; if (null != evaluationContext) { extensionsSection = (ExtensionsSection)ConfigurationHelpers.UnsafeGetAssociatedSection(evaluationContext, ConfigurationStrings.ExtensionsSectionPath); } else { if (DiagnosticUtility.ShouldTraceWarning) { TraceUtility.TraceEvent(TraceEventType.Warning, TraceCode.EvaluationContextNotFound, SR.GetString(SR.TraceCodeEvaluationContextNotFound), null, (Exception)null); } extensionsSection = (ExtensionsSection)ConfigurationHelpers.UnsafeGetSection(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); }
internal static ServiceHostingEnvironmentSection UnsafeGetSection() { return((ServiceHostingEnvironmentSection)ConfigurationHelpers.UnsafeGetSection(ConfigurationStrings.ServiceHostingEnvironmentSectionPath)); }
internal static DiagnosticSection UnsafeGetSection() { return((DiagnosticSection)ConfigurationHelpers.UnsafeGetSection(ConfigurationStrings.DiagnosticSectionPath)); }
internal static CommonBehaviorsSection UnsafeGetSection() { return((CommonBehaviorsSection)ConfigurationHelpers.UnsafeGetSection(ConfigurationStrings.CommonBehaviorsSectionPath)); }
internal static ClientSection UnsafeGetSection() { return((ClientSection)ConfigurationHelpers.UnsafeGetSection(ConfigurationStrings.ClientSectionPath)); }
internal static ProtocolMappingSection UnsafeGetSection() { return((ProtocolMappingSection)ConfigurationHelpers.UnsafeGetSection(ConfigurationStrings.ProtocolMappingSectionPath)); }