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
- InitializationEventAttribute.cs
- TypeSystemProvider.cs
- TagPrefixAttribute.cs
- PaintValueEventArgs.cs
- Utility.cs
- ObjectViewListener.cs
- ResourceExpression.cs
- SqlRowUpdatedEvent.cs
- Attributes.cs
- TextContainerChangedEventArgs.cs
- XPathEmptyIterator.cs
- wgx_sdk_version.cs
- PropertyIDSet.cs
- DnsEndpointIdentity.cs
- Control.cs
- PermissionSet.cs
- XamlParser.cs
- UriSchemeKeyedCollection.cs
- ManualResetEventSlim.cs
- CompModSwitches.cs
- ToolStripSystemRenderer.cs
- CodeThrowExceptionStatement.cs
- SystemKeyConverter.cs
- Table.cs
- QuaternionAnimation.cs
- DataGridViewCell.cs
- DataBindingExpressionBuilder.cs
- OutOfMemoryException.cs
- DBSqlParserTable.cs
- HotSpot.cs
- DockProviderWrapper.cs
- SystemInfo.cs
- ComboBoxAutomationPeer.cs
- DataChangedEventManager.cs
- SchemaSetCompiler.cs
- UIElementParaClient.cs
- TransformerConfigurationWizardBase.cs
- XDeferredAxisSource.cs
- WebBrowserUriTypeConverter.cs
- ControlIdConverter.cs
- XmlAttributeCollection.cs
- DerivedKeyCachingSecurityTokenSerializer.cs
- Visitors.cs
- PassportAuthentication.cs
- TimeSpan.cs
- TagPrefixAttribute.cs
- TreePrinter.cs
- QueryOperationResponseOfT.cs
- EditorZoneBase.cs
- TypeDependencyAttribute.cs
- ContentPlaceHolder.cs
- SplineKeyFrames.cs
- Resources.Designer.cs
- UntypedNullExpression.cs
- ADMembershipProvider.cs
- PersonalizationEntry.cs
- PrivilegedConfigurationManager.cs
- StateMachineSubscription.cs
- ObjectListItemCollection.cs
- controlskin.cs
- NativeMethodsCLR.cs
- ScriptResourceAttribute.cs
- PageStatePersister.cs
- DataGridViewControlCollection.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- PolyBezierSegmentFigureLogic.cs
- QilFunction.cs
- TextFormatter.cs
- ToolboxCategory.cs
- GridViewRow.cs
- OptionUsage.cs
- PrimitiveRenderer.cs
- KeyGesture.cs
- SessionIDManager.cs
- WaitHandle.cs
- ServiceOperationParameter.cs
- RSAPKCS1SignatureDeformatter.cs
- ContentElement.cs
- IDQuery.cs
- IriParsingElement.cs
- EntityKeyElement.cs
- XmlObjectSerializerWriteContextComplex.cs
- Metafile.cs
- DataGridHeaderBorder.cs
- ApplicationGesture.cs
- CheckBoxField.cs
- ProxyFragment.cs
- contentDescriptor.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- StylusDevice.cs
- AssociationSet.cs
- RIPEMD160.cs
- ExpandableObjectConverter.cs
- AppDomainShutdownMonitor.cs
- BinaryConverter.cs
- SpecialNameAttribute.cs
- TypedLocationWrapper.cs
- TextSegment.cs
- ConsoleKeyInfo.cs
- AuthenticationException.cs