Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / DeploymentSectionCache.cs / 1305376 / 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),
SecuritySafeCritical()
]
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),
SecuritySafeCritical()
]
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
- IdnMapping.cs
- BulletedList.cs
- XmlToDatasetMap.cs
- TextRunProperties.cs
- CodeAccessPermission.cs
- ReflectionTypeLoadException.cs
- EntityTransaction.cs
- TransformDescriptor.cs
- SqlMultiplexer.cs
- SqlDataSourceTableQuery.cs
- ApplicationActivator.cs
- GenerateScriptTypeAttribute.cs
- BamlMapTable.cs
- PreviewKeyDownEventArgs.cs
- IndependentlyAnimatedPropertyMetadata.cs
- behaviorssection.cs
- SerializationFieldInfo.cs
- SignedInfo.cs
- ColorBlend.cs
- FrameworkContentElementAutomationPeer.cs
- DataPagerCommandEventArgs.cs
- QuaternionConverter.cs
- Separator.cs
- XmlWriterTraceListener.cs
- SizeChangedInfo.cs
- ConfigurationStrings.cs
- ObjectCache.cs
- ObjectMemberMapping.cs
- IDispatchConstantAttribute.cs
- ResourceProviderFactory.cs
- IPAddressCollection.cs
- Emitter.cs
- DrawingGroupDrawingContext.cs
- OdbcEnvironmentHandle.cs
- Point3DKeyFrameCollection.cs
- DataFormats.cs
- DispatchWrapper.cs
- IsolatedStoragePermission.cs
- BindingValueChangedEventArgs.cs
- ViewSimplifier.cs
- RegexRunnerFactory.cs
- HeaderFilter.cs
- X509ChainPolicy.cs
- FrugalMap.cs
- Rect.cs
- QilParameter.cs
- PersistenceTypeAttribute.cs
- PageThemeParser.cs
- ListBase.cs
- StandardCommandToolStripMenuItem.cs
- WebConfigurationFileMap.cs
- FunctionDescription.cs
- CleanUpVirtualizedItemEventArgs.cs
- IgnoreDataMemberAttribute.cs
- SessionStateContainer.cs
- PointLightBase.cs
- IInstanceTable.cs
- Serializer.cs
- ImportCatalogPart.cs
- ResourcePool.cs
- WindowsListViewGroup.cs
- ReflectionServiceProvider.cs
- BeginEvent.cs
- DrawingImage.cs
- BamlRecordReader.cs
- VarInfo.cs
- SqlDataSourceQueryEditor.cs
- Localizer.cs
- Hex.cs
- AccessibilityHelperForXpWin2k3.cs
- StylusDownEventArgs.cs
- CalculatedColumn.cs
- Vector3DAnimationUsingKeyFrames.cs
- SystemIcons.cs
- SortedSetDebugView.cs
- DataControlFieldCollection.cs
- FixedNode.cs
- SourceChangedEventArgs.cs
- DataRecordObjectView.cs
- LicenseProviderAttribute.cs
- StrongTypingException.cs
- SafeRegistryKey.cs
- GridLength.cs
- LoaderAllocator.cs
- IndexedEnumerable.cs
- GridItem.cs
- Rect3D.cs
- BrushMappingModeValidation.cs
- EdmItemError.cs
- MediaSystem.cs
- BCLDebug.cs
- TextDecoration.cs
- TypedReference.cs
- GlobalAllocSafeHandle.cs
- ScrollContentPresenter.cs
- Int16KeyFrameCollection.cs
- CorrelationManager.cs
- WebControlParameterProxy.cs
- RowVisual.cs
- URLIdentityPermission.cs