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
- LinkLabel.cs
- ParenthesizePropertyNameAttribute.cs
- ICspAsymmetricAlgorithm.cs
- ViewStateException.cs
- BufferAllocator.cs
- mansign.cs
- ArrayTypeMismatchException.cs
- ZipIOLocalFileBlock.cs
- AsyncStreamReader.cs
- FilterElement.cs
- BindingWorker.cs
- CssTextWriter.cs
- GenericTransactionFlowAttribute.cs
- XPathAncestorIterator.cs
- Timer.cs
- MetaTableHelper.cs
- MouseActionConverter.cs
- BrowserCapabilitiesCompiler.cs
- XmlSchemaSet.cs
- WSHttpSecurityElement.cs
- MaskInputRejectedEventArgs.cs
- FontStretchConverter.cs
- EntitySetBaseCollection.cs
- SingleTagSectionHandler.cs
- ProcessHostFactoryHelper.cs
- compensatingcollection.cs
- TransactionInterop.cs
- GeometryCollection.cs
- XslVisitor.cs
- AppSettingsExpressionBuilder.cs
- EmptyEnumerable.cs
- ResetableIterator.cs
- UIElement.cs
- ExtendedProtectionPolicyTypeConverter.cs
- CriticalExceptions.cs
- Grant.cs
- hresults.cs
- ThreadSafeList.cs
- ThicknessConverter.cs
- ForeignKeyConstraint.cs
- DataAccessor.cs
- BitmapSourceSafeMILHandle.cs
- NopReturnReader.cs
- DetailsView.cs
- CodeSnippetExpression.cs
- TransformedBitmap.cs
- HostProtectionException.cs
- WorkerRequest.cs
- IssuanceTokenProviderState.cs
- RowUpdatedEventArgs.cs
- ComNativeDescriptor.cs
- WebPartHeaderCloseVerb.cs
- WindowAutomationPeer.cs
- TextFormatterImp.cs
- EventToken.cs
- Html32TextWriter.cs
- ExternalException.cs
- DataContractAttribute.cs
- DataMisalignedException.cs
- ValidationHelpers.cs
- ExtentKey.cs
- ApplicationManager.cs
- MatrixCamera.cs
- XhtmlBasicValidationSummaryAdapter.cs
- ListViewInsertEventArgs.cs
- SQLSingle.cs
- PackageStore.cs
- TextElementAutomationPeer.cs
- FixedPosition.cs
- TableRowCollection.cs
- XmlTextAttribute.cs
- NullReferenceException.cs
- DesignerActionGlyph.cs
- ParallelQuery.cs
- __Filters.cs
- WebPartVerb.cs
- DeadCharTextComposition.cs
- DataErrorValidationRule.cs
- BufferModeSettings.cs
- ArgumentNullException.cs
- IDQuery.cs
- ProviderCommandInfoUtils.cs
- ProcessHost.cs
- MemoryPressure.cs
- ComponentManagerBroker.cs
- ResourceAssociationType.cs
- CodeGenerator.cs
- SingleBodyParameterMessageFormatter.cs
- PropertyMapper.cs
- SafeFileHandle.cs
- SmiContext.cs
- ServiceDescription.cs
- RoleGroupCollection.cs
- RegexCapture.cs
- ScrollItemProviderWrapper.cs
- CheckBoxList.cs
- SQLMoneyStorage.cs
- CallbackBehaviorAttribute.cs
- HMACSHA1.cs
- ConfigXmlComment.cs