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
- Panel.cs
- TextContainer.cs
- ConsumerConnectionPointCollection.cs
- FormsAuthenticationEventArgs.cs
- DesignerHierarchicalDataSourceView.cs
- SectionUpdates.cs
- SectionVisual.cs
- ClusterSafeNativeMethods.cs
- TrackBarRenderer.cs
- TrackPointCollection.cs
- FormView.cs
- ListViewInsertedEventArgs.cs
- PageSettings.cs
- NodeInfo.cs
- SrgsText.cs
- SerializationObjectManager.cs
- CheckBoxStandardAdapter.cs
- PropertyMapper.cs
- ListViewInsertEventArgs.cs
- ReversePositionQuery.cs
- DataObject.cs
- ISessionStateStore.cs
- CodeSnippetCompileUnit.cs
- DataError.cs
- NumberSubstitution.cs
- QuaternionIndependentAnimationStorage.cs
- UIPermission.cs
- StringToken.cs
- HandleRef.cs
- ProfileParameter.cs
- DispatcherExceptionFilterEventArgs.cs
- SecurityChannelFaultConverter.cs
- UserMapPath.cs
- TimeStampChecker.cs
- InstanceCompleteException.cs
- SafeBitVector32.cs
- ImageCollectionEditor.cs
- QuinticEase.cs
- ValueExpressions.cs
- MissingMemberException.cs
- ChildTable.cs
- BrowserDefinitionCollection.cs
- GeneralTransformGroup.cs
- CodePrimitiveExpression.cs
- COAUTHINFO.cs
- Metadata.cs
- HtmlTernaryTree.cs
- ResXBuildProvider.cs
- ApplicationHost.cs
- ResourceProviderFactory.cs
- ParentControlDesigner.cs
- SafeNativeMethods.cs
- LassoHelper.cs
- BuildProvider.cs
- ObsoleteAttribute.cs
- BrowserCapabilitiesCodeGenerator.cs
- XmlNodeChangedEventArgs.cs
- XmlCharType.cs
- SqlDataSourceCommandEventArgs.cs
- ToolTip.cs
- XmlNotation.cs
- StringDictionaryCodeDomSerializer.cs
- CompositeTypefaceMetrics.cs
- InputScopeNameConverter.cs
- PeerCollaboration.cs
- ProfileService.cs
- HtmlTableCellCollection.cs
- DocumentCollection.cs
- FragmentQueryKB.cs
- AudioStateChangedEventArgs.cs
- ObjectManager.cs
- DeviceContext2.cs
- __Error.cs
- BinaryFormatter.cs
- XmlCharType.cs
- CreateUserWizardStep.cs
- DynamicValueConverter.cs
- DataContractJsonSerializer.cs
- CursorConverter.cs
- AxHost.cs
- ExpressionBinding.cs
- TextRangeProviderWrapper.cs
- Rectangle.cs
- LongValidatorAttribute.cs
- SupportingTokenChannel.cs
- ShaderEffect.cs
- SizeAnimationBase.cs
- CharacterString.cs
- TimerExtension.cs
- TrackingLocationCollection.cs
- FunctionDefinition.cs
- InkCanvasSelectionAdorner.cs
- AutoGeneratedFieldProperties.cs
- XsltFunctions.cs
- NonValidatingSecurityTokenAuthenticator.cs
- ProxyAttribute.cs
- DateTimeConverter2.cs
- BamlResourceSerializer.cs
- ScopelessEnumAttribute.cs
- ObjectListFieldCollection.cs