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
- StaticFileHandler.cs
- WebPartTracker.cs
- SerialPinChanges.cs
- DataServiceExpressionVisitor.cs
- CodeAccessPermission.cs
- ToolStripItemBehavior.cs
- PersonalizationAdministration.cs
- Verify.cs
- SslStream.cs
- ElasticEase.cs
- ClientUtils.cs
- Point3DAnimationUsingKeyFrames.cs
- SqlGatherConsumedAliases.cs
- BaseTemplateParser.cs
- loginstatus.cs
- UserControlParser.cs
- WebAdminConfigurationHelper.cs
- ThicknessAnimationUsingKeyFrames.cs
- XmlDocumentFragment.cs
- MessageQueuePermissionEntry.cs
- BuildProviderAppliesToAttribute.cs
- CacheOutputQuery.cs
- QuaternionAnimation.cs
- WebPartAddingEventArgs.cs
- ExclusiveCanonicalizationTransform.cs
- BinarySecretKeyIdentifierClause.cs
- DefaultEvaluationContext.cs
- XmlSchemaProviderAttribute.cs
- HttpCookie.cs
- Internal.cs
- SQLConvert.cs
- JournalEntry.cs
- XappLauncher.cs
- _NetworkingPerfCounters.cs
- CoreSwitches.cs
- Track.cs
- CommandValueSerializer.cs
- QuerySetOp.cs
- BinaryConverter.cs
- ContentIterators.cs
- DefaultValidator.cs
- ActiveXContainer.cs
- CodeDomExtensionMethods.cs
- Model3DGroup.cs
- ApplicationManager.cs
- ProfileGroupSettings.cs
- DataGridViewTextBoxCell.cs
- XsdValidatingReader.cs
- AppearanceEditorPart.cs
- AttributeData.cs
- DataPointer.cs
- UnsafeNativeMethodsTablet.cs
- infer.cs
- LineSegment.cs
- PasswordBoxAutomationPeer.cs
- MetadataCacheItem.cs
- RootBuilder.cs
- DropAnimation.xaml.cs
- SqlDataSourceTableQuery.cs
- propertyentry.cs
- PermissionRequestEvidence.cs
- Marshal.cs
- InputMethod.cs
- ConfigurationValues.cs
- LinkedResourceCollection.cs
- ModuleConfigurationInfo.cs
- ControlEvent.cs
- Site.cs
- CodeExporter.cs
- FragmentQueryProcessor.cs
- SimpleModelProvider.cs
- GrabHandleGlyph.cs
- RootBrowserWindowAutomationPeer.cs
- Button.cs
- _DomainName.cs
- ChunkedMemoryStream.cs
- LookupBindingPropertiesAttribute.cs
- ClosableStream.cs
- XmlReader.cs
- QilInvokeLateBound.cs
- ComNativeDescriptor.cs
- GroupPartitionExpr.cs
- WindowsTokenRoleProvider.cs
- DataControlLinkButton.cs
- ResourceLoader.cs
- EventListener.cs
- DesignerTransaction.cs
- CatalogPart.cs
- DelegateTypeInfo.cs
- ExternalFile.cs
- SignatureDescription.cs
- XmlSchemaComplexType.cs
- Query.cs
- LabelAutomationPeer.cs
- DefaultEvaluationContext.cs
- basevalidator.cs
- ToolboxDataAttribute.cs
- DockPattern.cs
- _NegoState.cs
- SqlXmlStorage.cs