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
- XmlAggregates.cs
- RegisteredArrayDeclaration.cs
- XmlSchemaSimpleTypeList.cs
- ClientTarget.cs
- ExtendedPropertyDescriptor.cs
- TableCellsCollectionEditor.cs
- PerfCounters.cs
- RequestCacheEntry.cs
- PenContexts.cs
- Font.cs
- XmlRawWriterWrapper.cs
- DataTableClearEvent.cs
- PageCatalogPart.cs
- DesignerGenericWebPart.cs
- Compensate.cs
- ExpressionVisitor.cs
- IncrementalHitTester.cs
- CryptoStream.cs
- FileIOPermission.cs
- WebPart.cs
- TrueReadOnlyCollection.cs
- DuplicateContext.cs
- WebPartsPersonalizationAuthorization.cs
- XmlSchemaType.cs
- ConnectionPointGlyph.cs
- OrderToken.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- HybridWebProxyFinder.cs
- Stackframe.cs
- MissingMethodException.cs
- ToolStripPanelCell.cs
- ModuleElement.cs
- BinaryEditor.cs
- AutoCompleteStringCollection.cs
- TraceHwndHost.cs
- FloaterBaseParaClient.cs
- WizardStepBase.cs
- FormsAuthenticationTicket.cs
- CodeTypeParameter.cs
- Multiply.cs
- RoleManagerSection.cs
- MissingSatelliteAssemblyException.cs
- NativeCompoundFileAPIs.cs
- PeerNode.cs
- RadioButton.cs
- AutoGeneratedField.cs
- Profiler.cs
- AutomationPattern.cs
- XPathDocumentNavigator.cs
- TableProviderWrapper.cs
- ping.cs
- SHA1Managed.cs
- XmlSchemaAnyAttribute.cs
- ScrollBar.cs
- ByteFacetDescriptionElement.cs
- LayoutUtils.cs
- BooleanKeyFrameCollection.cs
- formatter.cs
- AsyncOperationContext.cs
- TailCallAnalyzer.cs
- SafeCoTaskMem.cs
- Sentence.cs
- NavigationEventArgs.cs
- NameHandler.cs
- IndexOutOfRangeException.cs
- MessageHeaderDescriptionCollection.cs
- XmlSchemaAttribute.cs
- LinearQuaternionKeyFrame.cs
- EmbeddedMailObject.cs
- BoundColumn.cs
- NativeWrapper.cs
- DebugInfo.cs
- UserControlAutomationPeer.cs
- RestHandler.cs
- LabelExpression.cs
- ControlLocalizer.cs
- BamlTreeUpdater.cs
- AlternateViewCollection.cs
- DES.cs
- ErrorRuntimeConfig.cs
- webclient.cs
- PublisherIdentityPermission.cs
- DataGridViewLinkCell.cs
- PersonalizationProviderCollection.cs
- ReflectionPermission.cs
- InternalMappingException.cs
- DataKeyCollection.cs
- SecurityUtils.cs
- MenuItemStyleCollection.cs
- MetafileHeaderWmf.cs
- XmlUtilWriter.cs
- XpsFontSubsetter.cs
- CDSCollectionETWBCLProvider.cs
- XPathBinder.cs
- GridViewPageEventArgs.cs
- Link.cs
- DotAtomReader.cs
- KnownIds.cs
- TextSelectionProcessor.cs
- UIElementHelper.cs