Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- RadioButton.cs
- WinFormsComponentEditor.cs
- NativeMethods.cs
- CanExecuteRoutedEventArgs.cs
- MemoryPressure.cs
- AsymmetricKeyExchangeDeformatter.cs
- DynamicResourceExtensionConverter.cs
- HandlerFactoryWrapper.cs
- PersonalizationDictionary.cs
- AsyncOperationManager.cs
- ActivationServices.cs
- WindowsEditBoxRange.cs
- PointUtil.cs
- GetRecipientRequest.cs
- WebControlsSection.cs
- RuleRef.cs
- OutOfProcStateClientManager.cs
- ErasingStroke.cs
- SqlLiftWhereClauses.cs
- DataBinder.cs
- EmptyElement.cs
- ObjectParameterCollection.cs
- SafeRegistryHandle.cs
- XmlAttributes.cs
- NoClickablePointException.cs
- InputBuffer.cs
- DbConnectionStringBuilder.cs
- KeysConverter.cs
- LogicalExpressionTypeConverter.cs
- FrameAutomationPeer.cs
- ContainerControl.cs
- DataStorage.cs
- PinnedBufferMemoryStream.cs
- SqlDataSource.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- MgmtConfigurationRecord.cs
- KerberosReceiverSecurityToken.cs
- SessionPageStateSection.cs
- GlyphShapingProperties.cs
- DelegateSerializationHolder.cs
- DataComponentNameHandler.cs
- Trigger.cs
- xml.cs
- SqlCommand.cs
- XmlComplianceUtil.cs
- FormViewModeEventArgs.cs
- Win32Exception.cs
- RecordConverter.cs
- OdbcParameter.cs
- InstanceData.cs
- SinglePageViewer.cs
- DBCommand.cs
- Encoder.cs
- UpdatePanelTriggerCollection.cs
- QueryHandler.cs
- SpecularMaterial.cs
- InstanceHandleReference.cs
- DataGridColumnCollection.cs
- ThaiBuddhistCalendar.cs
- WebPartConnection.cs
- SchemaNotation.cs
- DelegatingConfigHost.cs
- RewritingPass.cs
- InertiaRotationBehavior.cs
- FolderLevelBuildProvider.cs
- DocumentViewerBaseAutomationPeer.cs
- SimpleHandlerBuildProvider.cs
- RtfControlWordInfo.cs
- FileInfo.cs
- IISMapPath.cs
- HandoffBehavior.cs
- DeflateInput.cs
- FormViewInsertedEventArgs.cs
- DetailsViewUpdateEventArgs.cs
- Constraint.cs
- EntityConnectionStringBuilderItem.cs
- DeliveryStrategy.cs
- FontUnit.cs
- HttpRequestBase.cs
- PropertyToken.cs
- ImageMap.cs
- FileDataSourceCache.cs
- ConfigurationManagerHelperFactory.cs
- _NegoState.cs
- InvalidDocumentContentsException.cs
- XamlSerializerUtil.cs
- ListInitExpression.cs
- FontResourceCache.cs
- SqlCommand.cs
- ContractComponent.cs
- TextBoxView.cs
- ClosableStream.cs
- FigureParaClient.cs
- FontWeights.cs
- ProviderException.cs
- ExpressionBuilder.cs
- HttpProfileBase.cs
- RoleGroupCollection.cs
- GeneratedView.cs
- LinqDataSourceUpdateEventArgs.cs