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
- KernelTypeValidation.cs
- Clause.cs
- SqlTypeConverter.cs
- ExpressionPrefixAttribute.cs
- DataPagerFieldItem.cs
- BufferedGraphics.cs
- _AutoWebProxyScriptWrapper.cs
- XmlObjectSerializerWriteContextComplex.cs
- xdrvalidator.cs
- PreservationFileWriter.cs
- ProviderConnectionPoint.cs
- SafeLibraryHandle.cs
- PathParser.cs
- HttpDebugHandler.cs
- OrderPreservingPipeliningMergeHelper.cs
- NativeMethods.cs
- RelationshipDetailsRow.cs
- ClientConvert.cs
- PLINQETWProvider.cs
- MinimizableAttributeTypeConverter.cs
- XmlChildNodes.cs
- UInt16Storage.cs
- Point4D.cs
- InheritablePropertyChangeInfo.cs
- XmlSchemaAttributeGroupRef.cs
- WebMessageBodyStyleHelper.cs
- ConvertersCollection.cs
- SafeReversePInvokeHandle.cs
- TreeNodeEventArgs.cs
- Rotation3DAnimation.cs
- DecimalAnimationBase.cs
- BindableTemplateBuilder.cs
- ReadOnlyAttribute.cs
- SecurityPolicySection.cs
- VisualBrush.cs
- ObjectDataSourceChooseTypePanel.cs
- CustomWebEventKey.cs
- ConnectionPointCookie.cs
- NotifyCollectionChangedEventArgs.cs
- ChangePassword.cs
- StylusDevice.cs
- MDIWindowDialog.cs
- PrePrepareMethodAttribute.cs
- ThicknessAnimationUsingKeyFrames.cs
- SRDisplayNameAttribute.cs
- CodeDelegateInvokeExpression.cs
- WindowsFormsLinkLabel.cs
- FactorySettingsElement.cs
- EntitySetBase.cs
- ProcessInputEventArgs.cs
- ellipse.cs
- InfoCardSymmetricCrypto.cs
- JsonQNameDataContract.cs
- ValuePatternIdentifiers.cs
- SrgsRuleRef.cs
- SoapEnumAttribute.cs
- SynchronizationContext.cs
- XmlILIndex.cs
- Serializer.cs
- NamespaceMapping.cs
- Exception.cs
- CompModSwitches.cs
- ReferenceEqualityComparer.cs
- OracleCommand.cs
- UrlMappingCollection.cs
- SelfIssuedSamlTokenFactory.cs
- SettingsPropertyValue.cs
- RepeaterItemCollection.cs
- TypeUtils.cs
- WmpBitmapEncoder.cs
- Storyboard.cs
- ApplicationHost.cs
- HotSpotCollection.cs
- SettingsPropertyValueCollection.cs
- PersistenceContextEnlistment.cs
- ChannelBinding.cs
- ResourcesChangeInfo.cs
- UnsafeNativeMethods.cs
- CreatingCookieEventArgs.cs
- DurableServiceAttribute.cs
- AdRotator.cs
- HtmlElementCollection.cs
- SimpleLine.cs
- MetafileHeader.cs
- ProfileParameter.cs
- PageSetupDialog.cs
- X500Name.cs
- ZeroOpNode.cs
- TypedElement.cs
- DataGridViewMethods.cs
- DataDocumentXPathNavigator.cs
- InstanceLockLostException.cs
- TargetConverter.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- FontEditor.cs
- PointLight.cs
- KeyTime.cs
- QueryConverter.cs
- EllipticalNodeOperations.cs
- TableAdapterManagerGenerator.cs