Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- ActivityMarkupSerializer.cs
- x509utils.cs
- XmlObjectSerializerReadContextComplex.cs
- Publisher.cs
- util.cs
- COMException.cs
- WinInetCache.cs
- FixedHyperLink.cs
- DbProviderFactoriesConfigurationHandler.cs
- DataGridCaption.cs
- Command.cs
- RegisteredExpandoAttribute.cs
- TraceInternal.cs
- ItemPager.cs
- SchemaElementLookUpTable.cs
- RemotingServices.cs
- Compress.cs
- GridViewRowEventArgs.cs
- _RegBlobWebProxyDataBuilder.cs
- Table.cs
- CodeDirectoryCompiler.cs
- BitmapMetadataEnumerator.cs
- ReadOnlyPropertyMetadata.cs
- MetaType.cs
- ReadOnlyTernaryTree.cs
- TypeLibConverter.cs
- LinkAreaEditor.cs
- XmlSchemaInfo.cs
- AssemblySettingAttributes.cs
- KnownBoxes.cs
- Debug.cs
- InputMethod.cs
- MediaElementAutomationPeer.cs
- FontDifferentiator.cs
- ContentWrapperAttribute.cs
- TrackingAnnotationCollection.cs
- WebPartConnectionsCloseVerb.cs
- UtilityExtension.cs
- KnownBoxes.cs
- OutputCacheSection.cs
- ModulesEntry.cs
- LazyInitializer.cs
- WebFormDesignerActionService.cs
- Int32Converter.cs
- WindowsFormsLinkLabel.cs
- XmlWhitespace.cs
- HintTextConverter.cs
- DataGridViewCell.cs
- InkCanvasSelection.cs
- MetadataItemSerializer.cs
- ServiceDebugBehavior.cs
- RadioButtonList.cs
- XamlTypeMapper.cs
- DetailsViewModeEventArgs.cs
- PropertyTabChangedEvent.cs
- WorkItem.cs
- ObjectStorage.cs
- SkipQueryOptionExpression.cs
- WsatServiceAddress.cs
- FontDriver.cs
- ArrangedElementCollection.cs
- PathSegment.cs
- BuildProviderAppliesToAttribute.cs
- CreateParams.cs
- TableLayoutPanel.cs
- SqlDataReaderSmi.cs
- TextWriterTraceListener.cs
- SpeechUI.cs
- ResolveRequestResponseAsyncResult.cs
- HashStream.cs
- GridErrorDlg.cs
- ProfileProvider.cs
- StorageInfo.cs
- GridEntry.cs
- DocumentApplicationJournalEntry.cs
- ScrollData.cs
- PathGradientBrush.cs
- DataTableCollection.cs
- DataControlFieldCollection.cs
- CheckBoxAutomationPeer.cs
- MouseGestureConverter.cs
- IpcChannel.cs
- SplitterPanelDesigner.cs
- URIFormatException.cs
- Literal.cs
- ProgressBar.cs
- XmlSubtreeReader.cs
- Roles.cs
- ModelItem.cs
- MessageHeaderDescriptionCollection.cs
- OpenTypeLayout.cs
- OutputCacheProfileCollection.cs
- DataGridViewTextBoxColumn.cs
- SqlDataSourceFilteringEventArgs.cs
- ServerReliableChannelBinder.cs
- TimeSpanMinutesConverter.cs
- Byte.cs
- TextHidden.cs
- Int32CollectionValueSerializer.cs
- DefaultDialogButtons.cs