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
- PackWebResponse.cs
- PermissionSetEnumerator.cs
- MetadataArtifactLoader.cs
- SimplePropertyEntry.cs
- SamlEvidence.cs
- CompositeDataBoundControl.cs
- DataPointer.cs
- OdbcPermission.cs
- ObjectItemCollection.cs
- IntersectQueryOperator.cs
- CultureNotFoundException.cs
- pingexception.cs
- BitArray.cs
- ClientBuildManagerCallback.cs
- FakeModelItemImpl.cs
- ObjectStateFormatter.cs
- DispatcherExceptionEventArgs.cs
- BindableTemplateBuilder.cs
- UpdateException.cs
- StringUtil.cs
- TypeUsageBuilder.cs
- SiteMapNode.cs
- IndexObject.cs
- ObjectDisposedException.cs
- AxDesigner.cs
- CodeTryCatchFinallyStatement.cs
- PersonalizationProviderCollection.cs
- TimeSpanStorage.cs
- AppDomainShutdownMonitor.cs
- NativeRecognizer.cs
- PropertyEmitter.cs
- FunctionParameter.cs
- SplineKeyFrames.cs
- JpegBitmapDecoder.cs
- Char.cs
- RotateTransform.cs
- ExpressionBuilder.cs
- wmiutil.cs
- JpegBitmapEncoder.cs
- AssemblyAttributes.cs
- CodeCompileUnit.cs
- NumericUpDownAcceleration.cs
- DoubleLink.cs
- GetImportFileNameRequest.cs
- ListControl.cs
- DataTableClearEvent.cs
- PointHitTestParameters.cs
- InternalResources.cs
- RemotingConfigParser.cs
- DBProviderConfigurationHandler.cs
- FilterException.cs
- XmlDocumentType.cs
- HttpListenerRequest.cs
- XmlFormatWriterGenerator.cs
- StringDictionaryCodeDomSerializer.cs
- TriggerCollection.cs
- IsolatedStorageException.cs
- DataControlFieldCell.cs
- TreeIterators.cs
- CheckBoxBaseAdapter.cs
- PagedDataSource.cs
- HashCryptoHandle.cs
- AssemblyAttributes.cs
- ApplyTemplatesAction.cs
- XslTransform.cs
- ScriptManagerProxy.cs
- ReachFixedDocumentSerializer.cs
- HtmlWindow.cs
- Configuration.cs
- CaseInsensitiveComparer.cs
- DataGridViewRowsRemovedEventArgs.cs
- SimplePropertyEntry.cs
- SelectionRangeConverter.cs
- AssemblyInfo.cs
- Win32Native.cs
- DrawingContextWalker.cs
- TableLayoutSettingsTypeConverter.cs
- JsonXmlDataContract.cs
- ExceptionTrace.cs
- ServiceAppDomainAssociationProvider.cs
- ActivityXRefPropertyEditor.cs
- ReferenceConverter.cs
- CodeExpressionStatement.cs
- RegexMatch.cs
- XsdDuration.cs
- DownloadProgressEventArgs.cs
- Border.cs
- JoinSymbol.cs
- LiteralTextContainerControlBuilder.cs
- InkCanvas.cs
- CompositionCommandSet.cs
- CodeAccessPermission.cs
- ImmutableObjectAttribute.cs
- ClassicBorderDecorator.cs
- DataSourceCache.cs
- PipeStream.cs
- ProbeMatchesCD1.cs
- ForwardPositionQuery.cs
- XmlSerializerFaultFormatter.cs
- URLString.cs