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
- SchemaExporter.cs
- IntAverageAggregationOperator.cs
- ArgumentValidation.cs
- BindableTemplateBuilder.cs
- GeneralTransform3DGroup.cs
- CodeAttributeArgumentCollection.cs
- SortAction.cs
- CaseInsensitiveHashCodeProvider.cs
- SchemaTableColumn.cs
- DbConvert.cs
- StylusOverProperty.cs
- DefaultWorkflowTransactionService.cs
- Size.cs
- MethodCallExpression.cs
- TextBoxDesigner.cs
- MediaEntryAttribute.cs
- Transform.cs
- ComplexPropertyEntry.cs
- Collection.cs
- ServiceInstallComponent.cs
- XpsStructure.cs
- ObjectSecurity.cs
- VariableAction.cs
- DateTimeOffset.cs
- PerspectiveCamera.cs
- BitmapEffectDrawingContent.cs
- ToolStripContextMenu.cs
- autovalidator.cs
- DataGridViewComboBoxEditingControl.cs
- PageThemeCodeDomTreeGenerator.cs
- TableRowGroup.cs
- Size.cs
- ToolBarButtonClickEvent.cs
- TextProperties.cs
- Oid.cs
- SignHashRequest.cs
- OleDbParameter.cs
- GridPatternIdentifiers.cs
- TextDecorations.cs
- WebServiceHandlerFactory.cs
- DataPagerFieldCollection.cs
- GcSettings.cs
- StorageScalarPropertyMapping.cs
- XmlSchemaObjectTable.cs
- DynamicDataManager.cs
- ConfigurationPropertyAttribute.cs
- CollectionViewGroupInternal.cs
- EmbeddedMailObject.cs
- CompositeCollection.cs
- ValidatorUtils.cs
- HttpCacheVary.cs
- FrameworkElementFactory.cs
- PointLightBase.cs
- RequestDescription.cs
- QilIterator.cs
- WizardPanel.cs
- Exceptions.cs
- Process.cs
- BrowserDefinitionCollection.cs
- StatusBarItem.cs
- StateBag.cs
- _SslState.cs
- EnumConverter.cs
- WaitingCursor.cs
- SchemaLookupTable.cs
- QueryOpeningEnumerator.cs
- SqlUnionizer.cs
- EntryPointNotFoundException.cs
- PropertyPathWorker.cs
- EdmToObjectNamespaceMap.cs
- KeyedCollection.cs
- PrintControllerWithStatusDialog.cs
- XsltArgumentList.cs
- NextPreviousPagerField.cs
- IgnorePropertiesAttribute.cs
- DocumentXmlWriter.cs
- RankException.cs
- NotImplementedException.cs
- TextWriterTraceListener.cs
- HtmlTextArea.cs
- Parser.cs
- InternalBufferOverflowException.cs
- SafeNativeMethodsCLR.cs
- AnnotationComponentManager.cs
- OdbcDataReader.cs
- SqlMultiplexer.cs
- AsyncResult.cs
- DirectoryObjectSecurity.cs
- BackStopAuthenticationModule.cs
- LinkLabelLinkClickedEvent.cs
- TextSpan.cs
- SiteMapNodeItem.cs
- DragSelectionMessageFilter.cs
- StyleSheet.cs
- SqlCacheDependencyDatabase.cs
- RelatedPropertyManager.cs
- TrackBarRenderer.cs
- Random.cs
- ResourceDescriptionAttribute.cs
- ModuleBuilder.cs