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
- DataServiceRequestOfT.cs
- ListItemCollection.cs
- ExceptionRoutedEventArgs.cs
- itemelement.cs
- ResourceAssociationType.cs
- SplashScreenNativeMethods.cs
- SafeEventHandle.cs
- CompositeCollection.cs
- DataGridViewComboBoxEditingControl.cs
- ScrollChrome.cs
- newinstructionaction.cs
- ImportException.cs
- GB18030Encoding.cs
- BeginStoryboard.cs
- VScrollProperties.cs
- Peer.cs
- ListBindableAttribute.cs
- ConfigurationCollectionAttribute.cs
- Preprocessor.cs
- ConfigurationStrings.cs
- TextBounds.cs
- Duration.cs
- ParserExtension.cs
- CodeDomExtensionMethods.cs
- ConfigUtil.cs
- WeakReadOnlyCollection.cs
- SimpleNameService.cs
- DynamicEntity.cs
- DynamicDataRoute.cs
- NetCodeGroup.cs
- MetadataUtilsSmi.cs
- BaseHashHelper.cs
- MultiView.cs
- NetCodeGroup.cs
- TextRangeAdaptor.cs
- SqlDataReader.cs
- AssociationType.cs
- TemplateColumn.cs
- CommonGetThemePartSize.cs
- PromptEventArgs.cs
- PriorityRange.cs
- ReferencedType.cs
- ErrorProvider.cs
- DataListItemEventArgs.cs
- DataTableMappingCollection.cs
- mactripleDES.cs
- ObjectStateManagerMetadata.cs
- MimeMultiPart.cs
- WebPartConnectionsCancelEventArgs.cs
- Window.cs
- Variable.cs
- Update.cs
- ExeConfigurationFileMap.cs
- TemplatedAdorner.cs
- DataKey.cs
- _SecureChannel.cs
- HttpApplicationFactory.cs
- sqlnorm.cs
- Funcletizer.cs
- FieldToken.cs
- ObjectListGeneralPage.cs
- EventKeyword.cs
- SqlConnectionPoolProviderInfo.cs
- StateRuntime.cs
- MimeParameter.cs
- AspProxy.cs
- RNGCryptoServiceProvider.cs
- QueryExpr.cs
- tooltip.cs
- AnimationClockResource.cs
- XmlMapping.cs
- HttpDictionary.cs
- WebPartChrome.cs
- AccessKeyManager.cs
- RuntimeEnvironment.cs
- ObjectPropertyMapping.cs
- UnSafeCharBuffer.cs
- HttpRequestContext.cs
- VariableQuery.cs
- CryptoStream.cs
- SQLDateTimeStorage.cs
- TraceContextEventArgs.cs
- DataGridViewComboBoxEditingControl.cs
- DurableInstanceManager.cs
- WebServiceErrorEvent.cs
- localization.cs
- RelationshipNavigation.cs
- SystemIPGlobalStatistics.cs
- HttpCapabilitiesSectionHandler.cs
- LongValidatorAttribute.cs
- DataGridViewElement.cs
- ParameterModifier.cs
- SQLChars.cs
- BaseCodeDomTreeGenerator.cs
- DependencyObjectProvider.cs
- Point3DIndependentAnimationStorage.cs
- ToolStripContentPanelRenderEventArgs.cs
- CodePageEncoding.cs
- CheckBoxField.cs
- XsdDuration.cs