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
- XmlArrayItemAttribute.cs
- View.cs
- StrongNameUtility.cs
- Switch.cs
- CustomErrorsSection.cs
- ColorTypeConverter.cs
- DoubleLink.cs
- XslTransform.cs
- SiteMapProvider.cs
- HttpApplicationStateBase.cs
- ViewgenGatekeeper.cs
- EdmToObjectNamespaceMap.cs
- Module.cs
- FontInfo.cs
- MdImport.cs
- TemplateControl.cs
- AlgoModule.cs
- PasswordTextNavigator.cs
- LogicalExpr.cs
- Separator.cs
- DeclaredTypeElementCollection.cs
- FeatureAttribute.cs
- RNGCryptoServiceProvider.cs
- ScopedKnownTypes.cs
- HwndTarget.cs
- CqlLexer.cs
- BindingExpression.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- AsnEncodedData.cs
- CommandDesigner.cs
- LabelLiteral.cs
- FileDialog_Vista.cs
- ToolBar.cs
- XmlSchemaCompilationSettings.cs
- Stylus.cs
- AlternateViewCollection.cs
- DataTemplate.cs
- CallbackValidatorAttribute.cs
- XPathBuilder.cs
- TableLayoutColumnStyleCollection.cs
- TransformGroup.cs
- BufferedGraphicsManager.cs
- DesignerEventService.cs
- BitmapPalettes.cs
- DataGridViewColumnTypeEditor.cs
- ObjectDataSourceDisposingEventArgs.cs
- XPathException.cs
- Application.cs
- ResXDataNode.cs
- ObjectDataProvider.cs
- FileDialog_Vista.cs
- MemberAccessException.cs
- NetworkInterface.cs
- BezierSegment.cs
- _NetRes.cs
- BuildProviderUtils.cs
- BinaryCommonClasses.cs
- UTF32Encoding.cs
- SizeAnimationUsingKeyFrames.cs
- TextEffect.cs
- Form.cs
- CodeBlockBuilder.cs
- ManagementBaseObject.cs
- HandlerBase.cs
- BitSet.cs
- GridLength.cs
- HtmlForm.cs
- GridViewDeleteEventArgs.cs
- RemotingConfiguration.cs
- GridItemProviderWrapper.cs
- TranslateTransform.cs
- MD5.cs
- TargetParameterCountException.cs
- CompoundFileStorageReference.cs
- XmlStreamNodeWriter.cs
- ObjectStateEntryDbDataRecord.cs
- EditorZone.cs
- SQLResource.cs
- WebPartConnectionsCancelVerb.cs
- XmlSchemaAnyAttribute.cs
- InternalTypeHelper.cs
- TraceListeners.cs
- GACMembershipCondition.cs
- PagedDataSource.cs
- SourceLineInfo.cs
- EntityCodeGenerator.cs
- RefType.cs
- ReservationNotFoundException.cs
- InitialServerConnectionReader.cs
- CodeValidator.cs
- KeyEventArgs.cs
- SqlColumnizer.cs
- ExponentialEase.cs
- Wildcard.cs
- Win32.cs
- HttpServerVarsCollection.cs
- StructuralType.cs
- ConstraintEnumerator.cs
- GridViewColumn.cs
- httpstaticobjectscollection.cs