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
- WindowsFont.cs
- CodeComment.cs
- TemplateAction.cs
- RSAOAEPKeyExchangeFormatter.cs
- DesignerActionGlyph.cs
- CrossSiteScriptingValidation.cs
- DataGridViewCellPaintingEventArgs.cs
- ImageMap.cs
- AdjustableArrowCap.cs
- ProcessHost.cs
- ProgramPublisher.cs
- ClientBuildManager.cs
- EditorZoneBase.cs
- PropertyValueChangedEvent.cs
- ASCIIEncoding.cs
- DataGridViewAutoSizeModeEventArgs.cs
- Thumb.cs
- HybridWebProxyFinder.cs
- LinqDataSourceSelectEventArgs.cs
- AccessDataSourceWizardForm.cs
- ServiceReference.cs
- DirtyTextRange.cs
- PrefixQName.cs
- QuerySettings.cs
- RepeatButton.cs
- SecurityAppliedMessage.cs
- ConstructorBuilder.cs
- WindowsStreamSecurityElement.cs
- RadioButtonRenderer.cs
- ChannelSinkStacks.cs
- ApplicationActivator.cs
- Peer.cs
- IntPtr.cs
- SynchronousChannelMergeEnumerator.cs
- WmlPageAdapter.cs
- ExceptionCollection.cs
- SqlDataReader.cs
- SchemaImporterExtensionElement.cs
- StorageScalarPropertyMapping.cs
- HtmlInputSubmit.cs
- AssemblyAttributesGoHere.cs
- BaseTemplateBuildProvider.cs
- LoginView.cs
- TableDetailsCollection.cs
- PublisherIdentityPermission.cs
- _Win32.cs
- CharacterShapingProperties.cs
- XPathArrayIterator.cs
- ResolveInfo.cs
- BinaryCommonClasses.cs
- ThreadStateException.cs
- ContextDataSourceContextData.cs
- ScriptManager.cs
- ListControlConvertEventArgs.cs
- AddInControllerImpl.cs
- StateMachineExecutionState.cs
- WebPartCollection.cs
- BooleanAnimationBase.cs
- StringFreezingAttribute.cs
- InvalidFilterCriteriaException.cs
- TimeEnumHelper.cs
- ComponentConverter.cs
- Size3DConverter.cs
- MetadataItem_Static.cs
- ReadOnlyMetadataCollection.cs
- BitmapSource.cs
- SecurityPermission.cs
- SymbolMethod.cs
- SqlDataSourceCache.cs
- InvokeProviderWrapper.cs
- EditingScope.cs
- HeaderedContentControl.cs
- BlurEffect.cs
- TrackingWorkflowEventArgs.cs
- ParameterToken.cs
- SQLDoubleStorage.cs
- RemoteWebConfigurationHostServer.cs
- NumericUpDown.cs
- MsmqIntegrationSecurityElement.cs
- SQLBinaryStorage.cs
- Currency.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- DataListItemCollection.cs
- GiveFeedbackEvent.cs
- StyleXamlParser.cs
- Model3DCollection.cs
- NonParentingControl.cs
- TreeNodeClickEventArgs.cs
- LocalServiceSecuritySettings.cs
- SchemaComplexType.cs
- ObjectDataSourceFilteringEventArgs.cs
- ListParaClient.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- ACL.cs
- XmlSchemaValidationException.cs
- Model3DGroup.cs
- UrlAuthFailureHandler.cs
- WebPartZone.cs
- MeshGeometry3D.cs
- AutoResizedEvent.cs