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
- ReaderWriterLockWrapper.cs
- ConditionChanges.cs
- Exceptions.cs
- ObjectStorage.cs
- PropertyFilterAttribute.cs
- EntityStoreSchemaFilterEntry.cs
- PrePostDescendentsWalker.cs
- PropertyFilterAttribute.cs
- FtpRequestCacheValidator.cs
- SecurityAccessDeniedException.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- WinEventHandler.cs
- DeploymentExceptionMapper.cs
- ButtonRenderer.cs
- XmlSchemas.cs
- ProfileGroupSettingsCollection.cs
- NameScope.cs
- PropertyMapper.cs
- SoapSchemaImporter.cs
- ScrollPatternIdentifiers.cs
- Missing.cs
- ScrollChrome.cs
- ListViewItemEventArgs.cs
- ObjectRef.cs
- ItemsControl.cs
- ExtensionMethods.cs
- SymbolUsageManager.cs
- GroupPartitionExpr.cs
- ScriptControlManager.cs
- DelegatedStream.cs
- ExpressionBuilder.cs
- DesignerOptionService.cs
- KeyValuePair.cs
- XmlElementElement.cs
- HwndHost.cs
- TextRunCacheImp.cs
- MDIControlStrip.cs
- QilInvokeLateBound.cs
- GridViewCellAutomationPeer.cs
- HandleRef.cs
- XmlExpressionDumper.cs
- ByteConverter.cs
- CollectionViewGroupRoot.cs
- BaseProcessor.cs
- DataServiceHost.cs
- TypeHelper.cs
- TypeNameConverter.cs
- TrackBarRenderer.cs
- AttributeTableBuilder.cs
- SqlCommandBuilder.cs
- VariantWrapper.cs
- Helpers.cs
- PersonalizationState.cs
- HierarchicalDataSourceDesigner.cs
- HandleCollector.cs
- ErrorWebPart.cs
- CustomTypeDescriptor.cs
- HebrewCalendar.cs
- SchemaTypeEmitter.cs
- XmlSchemaExporter.cs
- UserControlParser.cs
- Facet.cs
- UrlPath.cs
- StringBuilder.cs
- Connector.xaml.cs
- TraceData.cs
- WCFBuildProvider.cs
- ReferenceEqualityComparer.cs
- WorkflowEnvironment.cs
- OrderByQueryOptionExpression.cs
- WindowsPen.cs
- AsyncResult.cs
- _KerberosClient.cs
- DiscoveryProxy.cs
- ExceptionRoutedEventArgs.cs
- GenericTypeParameterBuilder.cs
- MoveSizeWinEventHandler.cs
- DocumentViewerHelper.cs
- RemotingConfigParser.cs
- SocketException.cs
- validationstate.cs
- RenderData.cs
- XhtmlTextWriter.cs
- DataGridViewControlCollection.cs
- TextServicesContext.cs
- PropertyInfoSet.cs
- TraceSource.cs
- GridViewPageEventArgs.cs
- NodeLabelEditEvent.cs
- BamlLocalizabilityResolver.cs
- ThreadLocal.cs
- XmlDataSourceView.cs
- DataBoundControl.cs
- TextServicesCompartmentEventSink.cs
- PrinterSettings.cs
- ProfileSettingsCollection.cs
- ComponentSerializationService.cs
- CallId.cs
- HMACMD5.cs
- UnsafeNativeMethods.cs