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
- DesignBindingPicker.cs
- SmtpCommands.cs
- RegexRunner.cs
- RelationshipManager.cs
- FileSecurity.cs
- FullTextState.cs
- PropertyContainer.cs
- ITreeGenerator.cs
- ScrollEventArgs.cs
- RootContext.cs
- RenderTargetBitmap.cs
- CheckBoxList.cs
- CacheDependency.cs
- CircleHotSpot.cs
- Point.cs
- MetaTableHelper.cs
- DesignerOptionService.cs
- VirtualDirectoryMapping.cs
- OperationAbortedException.cs
- Compiler.cs
- NameValuePermission.cs
- BinaryObjectInfo.cs
- Renderer.cs
- ProbeRequestResponseAsyncResult.cs
- ActivityScheduledQuery.cs
- EndpointDispatcherTable.cs
- Compilation.cs
- TransformConverter.cs
- ListViewItemEventArgs.cs
- StyleXamlTreeBuilder.cs
- Knowncolors.cs
- GroupQuery.cs
- DayRenderEvent.cs
- DrawingAttributeSerializer.cs
- MetadataArtifactLoaderCompositeResource.cs
- AnonymousIdentificationSection.cs
- MailAddress.cs
- TextSelectionProcessor.cs
- input.cs
- StateManager.cs
- ShowExpandedMultiValueConverter.cs
- _NTAuthentication.cs
- TextModifierScope.cs
- LexicalChunk.cs
- GPRECTF.cs
- ProfileSettingsCollection.cs
- ImageMap.cs
- StrokeNode.cs
- BinaryParser.cs
- StyleSelector.cs
- FullTrustAssembly.cs
- Visual3D.cs
- MessageLogTraceRecord.cs
- ObjectStorage.cs
- UrlMappingsSection.cs
- BinaryMethodMessage.cs
- CmsUtils.cs
- ScopeElementCollection.cs
- WebService.cs
- InstanceLockQueryResult.cs
- TwoPhaseCommitProxy.cs
- SamlAttributeStatement.cs
- TraceUtils.cs
- DataListItem.cs
- SafeLibraryHandle.cs
- DrawingContext.cs
- ConfigurationManagerHelperFactory.cs
- BookmarkWorkItem.cs
- FontFamily.cs
- TextEndOfLine.cs
- Span.cs
- Transform.cs
- ObfuscateAssemblyAttribute.cs
- XPathBinder.cs
- MarginsConverter.cs
- httpapplicationstate.cs
- ExeConfigurationFileMap.cs
- VirtualDirectoryMapping.cs
- _DisconnectOverlappedAsyncResult.cs
- PolicyManager.cs
- ViewStateException.cs
- TableLayoutPanelCodeDomSerializer.cs
- GatewayDefinition.cs
- FieldToken.cs
- StylusPointPropertyInfo.cs
- StringArrayConverter.cs
- SqlConnectionFactory.cs
- WebPartPersonalization.cs
- TextModifierScope.cs
- GZipStream.cs
- ValidationHelpers.cs
- Baml2006ReaderSettings.cs
- MULTI_QI.cs
- LinqDataSourceDeleteEventArgs.cs
- Rotation3DKeyFrameCollection.cs
- ObjectDataSourceDisposingEventArgs.cs
- IPeerNeighbor.cs
- RtfToXamlReader.cs
- _NetworkingPerfCounters.cs
- StringBlob.cs