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
- DocumentPageView.cs
- ResolveDuplex11AsyncResult.cs
- PageThemeCodeDomTreeGenerator.cs
- AddInControllerImpl.cs
- UpdateCommand.cs
- ConfigXmlCDataSection.cs
- HttpListenerTimeoutManager.cs
- PackageFilter.cs
- WebPartTransformerAttribute.cs
- ActionItem.cs
- SingleKeyFrameCollection.cs
- CollectionChangedEventManager.cs
- XmlText.cs
- HijriCalendar.cs
- IndependentAnimationStorage.cs
- CorrelationResolver.cs
- InternalDispatchObject.cs
- XmlUtil.cs
- Action.cs
- TabPanel.cs
- RegistrySecurity.cs
- EntitySqlException.cs
- ContentType.cs
- FormsAuthenticationTicket.cs
- ProgressiveCrcCalculatingStream.cs
- PtsCache.cs
- OrderedDictionaryStateHelper.cs
- MD5CryptoServiceProvider.cs
- MiniConstructorInfo.cs
- ClosableStream.cs
- ChineseLunisolarCalendar.cs
- BasePattern.cs
- PartialList.cs
- SamlDelegatingWriter.cs
- DayRenderEvent.cs
- ZoneLinkButton.cs
- SectionInformation.cs
- TableLayoutPanelResizeGlyph.cs
- CompilerInfo.cs
- PointIndependentAnimationStorage.cs
- XsdBuilder.cs
- VirtualizedItemProviderWrapper.cs
- ConnectorSelectionGlyph.cs
- latinshape.cs
- HashCodeCombiner.cs
- SecurityTokenProviderContainer.cs
- AdCreatedEventArgs.cs
- BindingCollection.cs
- SchemaCollectionPreprocessor.cs
- InternalsVisibleToAttribute.cs
- Visual3DCollection.cs
- CheckBoxFlatAdapter.cs
- TransformConverter.cs
- NameNode.cs
- ConfigXmlWhitespace.cs
- DataSourceCacheDurationConverter.cs
- CodeBinaryOperatorExpression.cs
- TracedNativeMethods.cs
- BitmapEffect.cs
- filewebresponse.cs
- XmlSchemaAttribute.cs
- ListParagraph.cs
- EditorServiceContext.cs
- HtmlProps.cs
- WebControlParameterProxy.cs
- ProfileProvider.cs
- DataComponentGenerator.cs
- EdmSchemaError.cs
- rsa.cs
- MsmqChannelFactoryBase.cs
- PropertyGridDesigner.cs
- PathData.cs
- AssociationEndMember.cs
- RoleManagerModule.cs
- UrlAuthorizationModule.cs
- DispatcherOperation.cs
- CellIdBoolean.cs
- SecurityState.cs
- ApplicationFileParser.cs
- MembershipPasswordException.cs
- ButtonField.cs
- templategroup.cs
- TextBoxRenderer.cs
- Separator.cs
- EncodingInfo.cs
- SourceInterpreter.cs
- StateManager.cs
- Panel.cs
- SqlMethodTransformer.cs
- ToolStripPanel.cs
- DbExpressionBuilder.cs
- InkPresenterAutomationPeer.cs
- CodeGroup.cs
- HttpRuntimeSection.cs
- BaseEntityWrapper.cs
- AlternationConverter.cs
- BaseDataList.cs
- ResourceReferenceKeyNotFoundException.cs
- EventLog.cs
- Rijndael.cs