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
- BindingMemberInfo.cs
- RegexCompilationInfo.cs
- TableLayout.cs
- SourceLocationProvider.cs
- EventKeyword.cs
- PageTheme.cs
- FileDataSourceCache.cs
- Misc.cs
- ReadWriteObjectLock.cs
- StatusBarAutomationPeer.cs
- StrongBox.cs
- Conditional.cs
- TextSpan.cs
- ReferentialConstraint.cs
- WmpBitmapEncoder.cs
- ConvertEvent.cs
- VScrollBar.cs
- XPathEmptyIterator.cs
- KeyGestureConverter.cs
- xsdvalidator.cs
- SubMenuStyleCollection.cs
- ModuleBuilder.cs
- XmlResolver.cs
- SoapAttributeAttribute.cs
- UntypedNullExpression.cs
- DataGridViewImageColumn.cs
- MediaSystem.cs
- TaskScheduler.cs
- Int64AnimationUsingKeyFrames.cs
- Win32.cs
- SelectionEditingBehavior.cs
- WebResourceUtil.cs
- RequestSecurityTokenResponse.cs
- GorillaCodec.cs
- BinaryWriter.cs
- DataPagerFieldItem.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- DefaultTextStoreTextComposition.cs
- XhtmlTextWriter.cs
- ReferencedType.cs
- GPRECTF.cs
- ClientTarget.cs
- SqlCacheDependencyDatabaseCollection.cs
- SqlProviderUtilities.cs
- XamlGridLengthSerializer.cs
- ObjectTag.cs
- DesignerAttribute.cs
- XmlQueryStaticData.cs
- DataTablePropertyDescriptor.cs
- FontCollection.cs
- ColorInterpolationModeValidation.cs
- PropertyCollection.cs
- FloaterParaClient.cs
- ActivityTypeResolver.xaml.cs
- RouteItem.cs
- ColorContext.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- TraceContextRecord.cs
- MimeMapping.cs
- MSG.cs
- SHA256.cs
- OleDbPermission.cs
- UserMapPath.cs
- _ContextAwareResult.cs
- SchemaElementLookUpTableEnumerator.cs
- regiisutil.cs
- FocusTracker.cs
- DescendantOverDescendantQuery.cs
- SynchronizedPool.cs
- SessionStateItemCollection.cs
- CommonDialog.cs
- DesignerLoader.cs
- FloatAverageAggregationOperator.cs
- WindowsToolbar.cs
- ClusterRegistryConfigurationProvider.cs
- MsmqHostedTransportConfiguration.cs
- ExceptionUtil.cs
- ToolCreatedEventArgs.cs
- ServiceOperationParameter.cs
- _NetworkingPerfCounters.cs
- ImageBrush.cs
- DrawingVisualDrawingContext.cs
- PersonalizationAdministration.cs
- InvalidAsynchronousStateException.cs
- MediaElement.cs
- SqlProcedureAttribute.cs
- XmlAttributeCollection.cs
- DocumentOrderQuery.cs
- SelectionRange.cs
- DataSourceCacheDurationConverter.cs
- ParameterToken.cs
- XsdDuration.cs
- ThicknessConverter.cs
- XmlObjectSerializerReadContext.cs
- CompressStream.cs
- ButtonBaseAutomationPeer.cs
- ToolZone.cs
- TraceUtility.cs
- DocumentEventArgs.cs
- WindowsFormsSectionHandler.cs