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
- ToolStripPanelRenderEventArgs.cs
- Frame.cs
- DataContractSerializer.cs
- SignatureDescription.cs
- WebExceptionStatus.cs
- MappingException.cs
- TypeNameHelper.cs
- UInt16.cs
- TimeSpanValidator.cs
- BamlRecords.cs
- DataGridCellEditEndingEventArgs.cs
- SmtpFailedRecipientException.cs
- ErrorView.xaml.cs
- FrameworkContentElementAutomationPeer.cs
- DeploymentExceptionMapper.cs
- StreamWriter.cs
- FixedBufferAttribute.cs
- StylusPointPropertyUnit.cs
- XomlSerializationHelpers.cs
- XsdDateTime.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- BaseDataListPage.cs
- SettingsPropertyValueCollection.cs
- SHA1CryptoServiceProvider.cs
- DetailsViewPagerRow.cs
- AnnotationHelper.cs
- ExceptionValidationRule.cs
- FloaterParaClient.cs
- CodeDirectiveCollection.cs
- ScrollEvent.cs
- RectangleF.cs
- DocumentEventArgs.cs
- VBIdentifierDesigner.xaml.cs
- DecoratedNameAttribute.cs
- DataSourceViewSchemaConverter.cs
- ViewBase.cs
- MobileErrorInfo.cs
- _DisconnectOverlappedAsyncResult.cs
- SqlCacheDependencyDatabase.cs
- FixedSOMElement.cs
- DesignTimeDataBinding.cs
- FixedSchema.cs
- EllipticalNodeOperations.cs
- Number.cs
- StorageScalarPropertyMapping.cs
- NetworkInformationPermission.cs
- RegexStringValidatorAttribute.cs
- FlowLayoutSettings.cs
- FixedDocument.cs
- TextAutomationPeer.cs
- CheckBoxList.cs
- DesignerAttribute.cs
- BamlRecordReader.cs
- RootBuilder.cs
- RenderContext.cs
- SuppressMessageAttribute.cs
- IntSecurity.cs
- EventManager.cs
- ComPlusContractBehavior.cs
- NavigateEvent.cs
- GeometryDrawing.cs
- AnnotationAuthorChangedEventArgs.cs
- StylusPointDescription.cs
- GridViewSortEventArgs.cs
- XPathNodeIterator.cs
- ErrorEventArgs.cs
- TraceInternal.cs
- HuffmanTree.cs
- SqlProvider.cs
- NamespaceQuery.cs
- ComponentDispatcherThread.cs
- Qualifier.cs
- XmlSortKey.cs
- PageBuildProvider.cs
- SByte.cs
- StorageEntitySetMapping.cs
- ListBindableAttribute.cs
- XmlNodeChangedEventArgs.cs
- AxParameterData.cs
- SafeEventLogWriteHandle.cs
- DrawingContext.cs
- BamlRecordReader.cs
- ErrorWrapper.cs
- basevalidator.cs
- UnsafeNativeMethods.cs
- UIElementIsland.cs
- WebConfigurationFileMap.cs
- Int16Converter.cs
- HMACMD5.cs
- Rfc2898DeriveBytes.cs
- BindingMAnagerBase.cs
- ExternalException.cs
- codemethodreferenceexpression.cs
- PropertyPath.cs
- WasHostedComPlusFactory.cs
- HtmlMeta.cs
- DataSourceUtil.cs
- LateBoundChannelParameterCollection.cs
- MdbDataFileEditor.cs
- SoapAttributeOverrides.cs