Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / behaviorssection.cs / 1 / behaviorssection.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { using System.Configuration; using System.Globalization; using System.ServiceModel; using System.Security; public partial class BehaviorsSection : ConfigurationSection { [ConfigurationProperty(ConfigurationStrings.EndpointBehaviors, Options = ConfigurationPropertyOptions.None)] public EndpointBehaviorElementCollection EndpointBehaviors { get { return (EndpointBehaviorElementCollection)base[ConfigurationStrings.EndpointBehaviors]; } } [ConfigurationProperty(ConfigurationStrings.ServiceBehaviors, Options = ConfigurationPropertyOptions.None)] public ServiceBehaviorElementCollection ServiceBehaviors { get { return (ServiceBehaviorElementCollection)base[ConfigurationStrings.ServiceBehaviors]; } } internal static BehaviorsSection GetSection() { return (BehaviorsSection)ConfigurationHelpers.GetSection(ConfigurationStrings.BehaviorsSectionPath); } ////// Critical - calls Critical method UnsafeGetSection which elevates in order to fetch config /// caller must guard access to resultant config section /// [SecurityCritical] internal static BehaviorsSection UnsafeGetSection() { return (BehaviorsSection)ConfigurationHelpers.UnsafeGetSection(ConfigurationStrings.BehaviorsSectionPath); } ////// Critical - calls Critical method UnsafeGetAssociatedSection which elevates in order to fetch config /// caller must guard access to resultant config section /// [SecurityCritical] internal static BehaviorsSection UnsafeGetAssociatedSection(ContextInformation evalContext) { return (BehaviorsSection)ConfigurationHelpers.UnsafeGetAssociatedSection(evalContext, ConfigurationStrings.BehaviorsSectionPath); } ////// Critical - calls UnsafeGetAssociatedSection which elevates /// Safe - doesn't leak resultant config /// [SecurityCritical, SecurityTreatAsSafe] internal static void ValidateEndpointBehaviorReference(string behaviorConfiguration, ContextInformation evaluationContext, ConfigurationElement configurationElement) { // ValidateBehaviorReference built on assumption that evaluationContext 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. if (null == evaluationContext) { DiagnosticUtility.DebugAssert("ValidateBehaviorReference() should only called with valid ContextInformation"); DiagnosticUtility.FailFast("ValidateBehaviorReference() should only called with valid ContextInformation"); } if (!String.IsNullOrEmpty(behaviorConfiguration)) { BehaviorsSection behaviors = (BehaviorsSection)ConfigurationHelpers.UnsafeGetAssociatedSection(evaluationContext, ConfigurationStrings.BehaviorsSectionPath); if (!behaviors.EndpointBehaviors.ContainsKey(behaviorConfiguration)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigInvalidEndpointBehavior, behaviorConfiguration), configurationElement.ElementInformation.Source, configurationElement.ElementInformation.LineNumber)); } } } ////// Critical - calls UnsafeGetAssociatedSection which elevates /// Safe - doesn't leak resultant config /// [SecurityCritical, SecurityTreatAsSafe] internal static void ValidateServiceBehaviorReference(string behaviorConfiguration, ContextInformation evaluationContext, ConfigurationElement configurationElement) { // ValidateBehaviorReference built on assumption that evaluationContext 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. if (null == evaluationContext) { DiagnosticUtility.DebugAssert("ValidateBehaviorReference() should only called with valid ContextInformation"); DiagnosticUtility.FailFast("ValidateBehaviorReference() should only called with valid ContextInformation"); } if (!String.IsNullOrEmpty(behaviorConfiguration)) { BehaviorsSection behaviors = (BehaviorsSection)ConfigurationHelpers.UnsafeGetAssociatedSection(evaluationContext, ConfigurationStrings.BehaviorsSectionPath); if (!behaviors.ServiceBehaviors.ContainsKey(behaviorConfiguration)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigInvalidServiceBehavior, behaviorConfiguration), configurationElement.ElementInformation.Source, configurationElement.ElementInformation.LineNumber)); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ToolStripProgressBar.cs
- WebPartVerb.cs
- Select.cs
- ItemMap.cs
- DomainConstraint.cs
- ConfigurationErrorsException.cs
- wmiprovider.cs
- WebRequestModuleElement.cs
- SQLByteStorage.cs
- ConnectionOrientedTransportChannelFactory.cs
- RegisteredHiddenField.cs
- TcpChannelHelper.cs
- LassoSelectionBehavior.cs
- Win32Native.cs
- FrameworkObject.cs
- FragmentNavigationEventArgs.cs
- DropSource.cs
- SqlDataSourceCommandEventArgs.cs
- HttpException.cs
- WebPartManagerDesigner.cs
- SqlDataAdapter.cs
- TreeNodeMouseHoverEvent.cs
- SettingsPropertyCollection.cs
- COAUTHINFO.cs
- DebuggerAttributes.cs
- TargetControlTypeAttribute.cs
- SqlDataSource.cs
- CultureTableRecord.cs
- SharedPerformanceCounter.cs
- TypedTableBaseExtensions.cs
- RectIndependentAnimationStorage.cs
- DebugHandleTracker.cs
- TcpChannelFactory.cs
- GAC.cs
- BuildManager.cs
- MatrixAnimationBase.cs
- KoreanCalendar.cs
- SqlException.cs
- AnnotationObservableCollection.cs
- DetailsViewUpdatedEventArgs.cs
- XmlSchemaDocumentation.cs
- EnumBuilder.cs
- DoubleIndependentAnimationStorage.cs
- StrokeDescriptor.cs
- ColorConvertedBitmap.cs
- IIS7UserPrincipal.cs
- PreviewKeyDownEventArgs.cs
- XPathNodeHelper.cs
- FormatSettings.cs
- DoubleLink.cs
- SoapBinding.cs
- FileEnumerator.cs
- TailPinnedEventArgs.cs
- InstanceHandleReference.cs
- ThemeableAttribute.cs
- BoundColumn.cs
- ParseHttpDate.cs
- MdiWindowListStrip.cs
- StyleXamlParser.cs
- ThemeDirectoryCompiler.cs
- DataTableNewRowEvent.cs
- XmlSchemaChoice.cs
- ImageField.cs
- ClientBuildManagerCallback.cs
- SharedPersonalizationStateInfo.cs
- EntityCodeGenerator.cs
- CompositeActivityTypeDescriptor.cs
- TabControl.cs
- XmlWrappingReader.cs
- SectionInformation.cs
- AuthorizationRuleCollection.cs
- DefaultPerformanceCounters.cs
- Facet.cs
- DummyDataSource.cs
- UiaCoreProviderApi.cs
- _SslState.cs
- ToolStripDropDownClosingEventArgs.cs
- NumberFunctions.cs
- WebScriptEnablingElement.cs
- QilXmlReader.cs
- ChannelCacheDefaults.cs
- FilterElement.cs
- DataServiceBuildProvider.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- QilChoice.cs
- Soap12FormatExtensions.cs
- ApplicationSecurityInfo.cs
- DictionarySectionHandler.cs
- WorkflowStateRollbackService.cs
- StyleReferenceConverter.cs
- SkinIDTypeConverter.cs
- BufferBuilder.cs
- printdlgexmarshaler.cs
- XamlFigureLengthSerializer.cs
- InstanceStore.cs
- ActivityExecutor.cs
- SecurityPermission.cs
- RepeatButtonAutomationPeer.cs
- activationcontext.cs
- HtmlEncodedRawTextWriter.cs