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
- GridViewSortEventArgs.cs
- IntellisenseTextBox.cs
- SafeLibraryHandle.cs
- CustomDictionarySources.cs
- rsa.cs
- NonSerializedAttribute.cs
- IApplicationTrustManager.cs
- WebEvents.cs
- DelimitedListTraceListener.cs
- CommandField.cs
- ViewManager.cs
- ContractMapping.cs
- ExpressionBinding.cs
- TTSEngineProxy.cs
- CacheModeValueSerializer.cs
- PropertyPushdownHelper.cs
- OutputCacheSettings.cs
- XPathSelectionIterator.cs
- ProfileServiceManager.cs
- TextDecorationLocationValidation.cs
- VectorAnimation.cs
- MaskedTextBoxTextEditorDropDown.cs
- XmlUrlResolver.cs
- NavigatorOutput.cs
- PartialArray.cs
- BlockCollection.cs
- ContextQuery.cs
- XamlFigureLengthSerializer.cs
- XNodeValidator.cs
- WindowsFormsSynchronizationContext.cs
- ResumeStoryboard.cs
- TextCompositionManager.cs
- DBCommandBuilder.cs
- PasswordRecovery.cs
- Relationship.cs
- HttpHandler.cs
- HandleCollector.cs
- XPathSelectionIterator.cs
- SqlDeflator.cs
- StandardToolWindows.cs
- EventLog.cs
- CapiSafeHandles.cs
- UIElement3D.cs
- SqlEnums.cs
- NoPersistProperty.cs
- Overlapped.cs
- ButtonStandardAdapter.cs
- SubpageParaClient.cs
- XPathNodeIterator.cs
- DataGridViewElement.cs
- DataRow.cs
- InfoCardSymmetricCrypto.cs
- Avt.cs
- GrammarBuilderPhrase.cs
- Pkcs9Attribute.cs
- TextProperties.cs
- storagemappingitemcollection.viewdictionary.cs
- IListConverters.cs
- _SSPIWrapper.cs
- IndexerNameAttribute.cs
- SingleAnimationUsingKeyFrames.cs
- ObjectStateEntryDbDataRecord.cs
- XmlObjectSerializer.cs
- ImageCodecInfo.cs
- OuterGlowBitmapEffect.cs
- InfiniteTimeSpanConverter.cs
- ThicknessKeyFrameCollection.cs
- Int64Storage.cs
- MenuItemBinding.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- XamlWriter.cs
- Label.cs
- ListControl.cs
- GAC.cs
- CriticalFinalizerObject.cs
- ByteStreamMessageEncoderFactory.cs
- XmlSchemaIdentityConstraint.cs
- HierarchicalDataSourceControl.cs
- ComponentCollection.cs
- DataGridViewComboBoxColumn.cs
- AdapterUtil.cs
- RichTextBox.cs
- Logging.cs
- _IPv4Address.cs
- WebEventCodes.cs
- MediaEntryAttribute.cs
- UriScheme.cs
- SchemaTypeEmitter.cs
- EntitySetDataBindingList.cs
- Processor.cs
- PtsContext.cs
- PrintingPermissionAttribute.cs
- AesCryptoServiceProvider.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- ConsoleEntryPoint.cs
- AbsoluteQuery.cs
- AttachedPropertyInfo.cs
- ListenerElementsCollection.cs
- X509Certificate2Collection.cs
- Int16Converter.cs