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
- Not.cs
- NativeMethods.cs
- TimeSpanValidator.cs
- CombinedGeometry.cs
- StrongName.cs
- xmlfixedPageInfo.cs
- LoginUtil.cs
- List.cs
- SchemaCollectionCompiler.cs
- DigitShape.cs
- WSSecurityOneDotZeroSendSecurityHeader.cs
- StringFreezingAttribute.cs
- TypeUnloadedException.cs
- ADConnectionHelper.cs
- WebPartConnection.cs
- WindowsMenu.cs
- DesignerSerializationVisibilityAttribute.cs
- SQLInt64Storage.cs
- XmlSchemaSimpleContentExtension.cs
- InputProcessorProfilesLoader.cs
- _FtpControlStream.cs
- ScriptBehaviorDescriptor.cs
- FunctionParameter.cs
- AuthenticateEventArgs.cs
- Matrix3DStack.cs
- PartEditor.cs
- StickyNoteAnnotations.cs
- RegularExpressionValidator.cs
- MetafileEditor.cs
- SystemDiagnosticsSection.cs
- ParallelQuery.cs
- ArrayElementGridEntry.cs
- ArrayTypeMismatchException.cs
- WebSysDescriptionAttribute.cs
- ConstraintStruct.cs
- XmlSchemaInferenceException.cs
- DefaultDiscoveryServiceExtension.cs
- WindowsRichEditRange.cs
- XmlSchemaAttributeGroupRef.cs
- httpapplicationstate.cs
- PerformanceCounters.cs
- FrameworkTemplate.cs
- UriTemplateHelpers.cs
- Matrix3DValueSerializer.cs
- AuditLog.cs
- BitmapData.cs
- ExpressionBindingCollection.cs
- WindowsRichEditRange.cs
- ServiceObjectContainer.cs
- DelegatedStream.cs
- DiagnosticTraceSource.cs
- TextProviderWrapper.cs
- SubMenuStyleCollection.cs
- GeometryModel3D.cs
- XamlPointCollectionSerializer.cs
- ParallelLoopState.cs
- DataGridTablesFactory.cs
- NameValueConfigurationElement.cs
- LoginUtil.cs
- Component.cs
- MaterialGroup.cs
- SequenceRangeCollection.cs
- DeclarativeCatalogPart.cs
- Assembly.cs
- WebPartsPersonalizationAuthorization.cs
- TextServicesManager.cs
- SqlTopReducer.cs
- PublisherIdentityPermission.cs
- RequestValidator.cs
- HTMLTagNameToTypeMapper.cs
- StylusPlugInCollection.cs
- MenuEventArgs.cs
- HtmlTableRow.cs
- X509ChainElement.cs
- ProfileGroupSettingsCollection.cs
- DependencyObjectType.cs
- ApplicationServicesHostFactory.cs
- PrePostDescendentsWalker.cs
- HostingEnvironment.cs
- WebPartDisplayModeCancelEventArgs.cs
- ArithmeticLiteral.cs
- EnumValAlphaComparer.cs
- PropertySegmentSerializationProvider.cs
- DropDownList.cs
- VBIdentifierName.cs
- DataGridTableCollection.cs
- RTLAwareMessageBox.cs
- SystemInfo.cs
- OrderedParallelQuery.cs
- regiisutil.cs
- ExportOptions.cs
- NameValuePair.cs
- Repeater.cs
- RemotingConfigParser.cs
- CultureTableRecord.cs
- SecondaryIndex.cs
- ResizeGrip.cs
- IsolatedStoragePermission.cs
- UpdateManifestForBrowserApplication.cs
- RequestUriProcessor.cs