Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / xsp / System / Web / Extensions / ui / DeploymentSectionCache.cs / 1 / DeploymentSectionCache.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI {
using System;
using System.Configuration;
using System.Security;
using System.Security.Permissions;
using System.Web.Configuration;
// DeploymentSection can only be defined in machine.config, so it is safe to cache statically in the application
internal sealed class DeploymentSectionCache : IDeploymentSection {
private static readonly DeploymentSectionCache _instance = new DeploymentSectionCache();
// Value is cached statically, because DeploymentSectionCache is a Singleton.
private bool? _retail;
private DeploymentSectionCache() {
}
public static DeploymentSectionCache Instance {
get {
return _instance;
}
}
public bool Retail {
get {
if (_retail == null) {
_retail = GetRetailFromConfig();
}
return _retail.Value;
}
}
[
ConfigurationPermission(SecurityAction.Assert, Unrestricted = true),
SecurityCritical(),
SecurityTreatAsSafe(),
]
private static bool GetRetailFromConfig() {
DeploymentSection section = (DeploymentSection)WebConfigurationManager.GetSection("system.web/deployment");
return section.Retail;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI {
using System;
using System.Configuration;
using System.Security;
using System.Security.Permissions;
using System.Web.Configuration;
// DeploymentSection can only be defined in machine.config, so it is safe to cache statically in the application
internal sealed class DeploymentSectionCache : IDeploymentSection {
private static readonly DeploymentSectionCache _instance = new DeploymentSectionCache();
// Value is cached statically, because DeploymentSectionCache is a Singleton.
private bool? _retail;
private DeploymentSectionCache() {
}
public static DeploymentSectionCache Instance {
get {
return _instance;
}
}
public bool Retail {
get {
if (_retail == null) {
_retail = GetRetailFromConfig();
}
return _retail.Value;
}
}
[
ConfigurationPermission(SecurityAction.Assert, Unrestricted = true),
SecurityCritical(),
SecurityTreatAsSafe(),
]
private static bool GetRetailFromConfig() {
DeploymentSection section = (DeploymentSection)WebConfigurationManager.GetSection("system.web/deployment");
return section.Retail;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LightweightEntityWrapper.cs
- InfoCardXmlSerializer.cs
- PageAdapter.cs
- ResizeGrip.cs
- XmlResolver.cs
- GridLength.cs
- CommonProperties.cs
- DataTransferEventArgs.cs
- PropertyIDSet.cs
- CollectionViewGroup.cs
- _ListenerRequestStream.cs
- WebPartUtil.cs
- ListBindingHelper.cs
- ObjectListGeneralPage.cs
- Encoder.cs
- Journal.cs
- ArglessEventHandlerProxy.cs
- XpsInterleavingPolicy.cs
- ELinqQueryState.cs
- Stackframe.cs
- System.Data.OracleClient_BID.cs
- SplitContainer.cs
- BasicExpressionVisitor.cs
- xmlsaver.cs
- InstanceDataCollectionCollection.cs
- TextFormatter.cs
- TaskFormBase.cs
- HMAC.cs
- DispatchWrapper.cs
- ConstraintStruct.cs
- UIPermission.cs
- DataControlPagerLinkButton.cs
- HostProtectionException.cs
- LockedHandleGlyph.cs
- LayoutExceptionEventArgs.cs
- ToolboxItemCollection.cs
- Point4DConverter.cs
- TdsParserSafeHandles.cs
- BindingCompleteEventArgs.cs
- StructuredTypeEmitter.cs
- MappingMetadataHelper.cs
- ProviderSettingsCollection.cs
- CollectionConverter.cs
- precedingquery.cs
- BuildProviderAppliesToAttribute.cs
- SqlTriggerContext.cs
- UnsafeNativeMethods.cs
- AssemblyBuilderData.cs
- Win32NamedPipes.cs
- MD5HashHelper.cs
- AnnotationHelper.cs
- SafeLocalMemHandle.cs
- HiddenFieldPageStatePersister.cs
- Thumb.cs
- ListViewInsertionMark.cs
- MatrixTransform.cs
- XmlUnspecifiedAttribute.cs
- AnimationClock.cs
- ExtenderProvidedPropertyAttribute.cs
- FieldNameLookup.cs
- RemotingException.cs
- AppModelKnownContentFactory.cs
- DataGridViewCell.cs
- ContainerUIElement3D.cs
- DocumentAutomationPeer.cs
- OverflowException.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- PauseStoryboard.cs
- XmlSchemaElement.cs
- UrlMapping.cs
- SupportedAddressingMode.cs
- _CookieModule.cs
- InputScope.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- TrackingExtract.cs
- ComplexBindingPropertiesAttribute.cs
- PropertyGeneratedEventArgs.cs
- ThreadAttributes.cs
- OrderByLifter.cs
- BitmapDecoder.cs
- PaintValueEventArgs.cs
- CAGDesigner.cs
- BitmapPalette.cs
- Misc.cs
- StoreAnnotationsMap.cs
- TextCollapsingProperties.cs
- ConfigXmlElement.cs
- EventLogSession.cs
- ApplicationManager.cs
- PropertyReferenceExtension.cs
- SoapHeaders.cs
- LogReservationCollection.cs
- XPathBinder.cs
- JapaneseLunisolarCalendar.cs
- WebService.cs
- TemplateParser.cs
- ProxySimple.cs
- RuntimeIdentifierPropertyAttribute.cs
- ListViewEditEventArgs.cs
- TcpServerChannel.cs