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
- _SslSessionsCache.cs
- LayoutEditorPart.cs
- SequenceRangeCollection.cs
- IPPacketInformation.cs
- WebPartActionVerb.cs
- StylusTip.cs
- DEREncoding.cs
- BindingListCollectionView.cs
- SQLBinary.cs
- StringExpressionSet.cs
- XmlNodeList.cs
- Encoder.cs
- Message.cs
- DataBoundControl.cs
- InputLanguageSource.cs
- SQLGuid.cs
- ScriptReferenceEventArgs.cs
- HebrewNumber.cs
- FileLoadException.cs
- VoiceInfo.cs
- UIElement.cs
- InfoCardTrace.cs
- LoginName.cs
- InputEventArgs.cs
- DbDataSourceEnumerator.cs
- Property.cs
- Shape.cs
- UInt16Storage.cs
- AsyncOperation.cs
- EntityContainerAssociationSetEnd.cs
- Socket.cs
- X509Certificate.cs
- SystemEvents.cs
- SizeConverter.cs
- BoundPropertyEntry.cs
- hwndwrapper.cs
- Exceptions.cs
- PersonalizationProviderCollection.cs
- UIPropertyMetadata.cs
- CfgSemanticTag.cs
- ImageCollectionEditor.cs
- ConsumerConnectionPointCollection.cs
- SqlConnectionFactory.cs
- CallbackValidatorAttribute.cs
- FilterUserControlBase.cs
- CodeGeneratorOptions.cs
- FormsAuthenticationCredentials.cs
- AnnotationResourceChangedEventArgs.cs
- WebDescriptionAttribute.cs
- VariableElement.cs
- SqlInternalConnectionTds.cs
- BufferBuilder.cs
- KeyGestureValueSerializer.cs
- ColumnCollection.cs
- ObjectReferenceStack.cs
- WebServiceEndpoint.cs
- VisualBrush.cs
- Matrix3DStack.cs
- DBNull.cs
- TextEditorThreadLocalStore.cs
- CategoryGridEntry.cs
- ETagAttribute.cs
- MembershipSection.cs
- ChildTable.cs
- ExpressionPrinter.cs
- StreamReader.cs
- WebBrowsableAttribute.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- BinaryKeyIdentifierClause.cs
- OutputCacheSection.cs
- HwndHostAutomationPeer.cs
- UnsafeNativeMethodsCLR.cs
- ImageDrawing.cs
- __Error.cs
- ConfigurationSettings.cs
- MessageFilterException.cs
- DataServiceExpressionVisitor.cs
- PartitionedDataSource.cs
- EtwTrackingBehavior.cs
- TagMapCollection.cs
- TargetControlTypeAttribute.cs
- XmlDictionaryReaderQuotas.cs
- SmtpReplyReader.cs
- ToolBarPanel.cs
- InkPresenterAutomationPeer.cs
- SignedXml.cs
- CollectionChangedEventManager.cs
- OptimalBreakSession.cs
- ControlEvent.cs
- Executor.cs
- UidPropertyAttribute.cs
- ControllableStoryboardAction.cs
- Query.cs
- InstanceDataCollectionCollection.cs
- ApplicationGesture.cs
- ImpersonationContext.cs
- Highlights.cs
- ErrorWebPart.cs
- VScrollBar.cs
- DisplayNameAttribute.cs