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
- DataControlLinkButton.cs
- ComNativeDescriptor.cs
- OdbcConnection.cs
- LocationUpdates.cs
- SrgsRule.cs
- DurableInstancingOptions.cs
- TemplateField.cs
- CodeCastExpression.cs
- ServiceHostingEnvironment.cs
- EventDescriptor.cs
- PreviewPrintController.cs
- RightsManagementEncryptedStream.cs
- SecurityCriticalDataForSet.cs
- MoveSizeWinEventHandler.cs
- MailMessage.cs
- TiffBitmapEncoder.cs
- RotateTransform3D.cs
- X509CertificateTrustedIssuerElementCollection.cs
- ListItemCollection.cs
- QilChoice.cs
- TakeOrSkipWhileQueryOperator.cs
- WmlTextViewAdapter.cs
- ValidatedControlConverter.cs
- SqlProcedureAttribute.cs
- TextStore.cs
- VisualProxy.cs
- ErrorEventArgs.cs
- ApplicationGesture.cs
- HtmlListAdapter.cs
- HtmlLink.cs
- EventProxy.cs
- TdsParserStateObject.cs
- XmlSchemaException.cs
- CssTextWriter.cs
- WinEventHandler.cs
- DataColumn.cs
- LogAppendAsyncResult.cs
- WebRequestModulesSection.cs
- EventDescriptorCollection.cs
- CheckBoxList.cs
- DataBoundControlAdapter.cs
- OdbcCommand.cs
- Lookup.cs
- XmlUtil.cs
- EvidenceTypeDescriptor.cs
- XmlSchemaGroupRef.cs
- RoutedEventValueSerializer.cs
- ImportCatalogPart.cs
- TransferMode.cs
- SystemTcpConnection.cs
- CombinedGeometry.cs
- WebPartMenuStyle.cs
- RoleBoolean.cs
- DocumentReference.cs
- MDIControlStrip.cs
- LogicalExpressionEditor.cs
- Polygon.cs
- SpellerInterop.cs
- SqlDependencyListener.cs
- ScriptMethodAttribute.cs
- StructuralObject.cs
- StorageRoot.cs
- PolyBezierSegment.cs
- DataGridTablesFactory.cs
- DockingAttribute.cs
- XmlAttributeOverrides.cs
- CapabilitiesRule.cs
- DataGridViewIntLinkedList.cs
- WebPartConnectionsEventArgs.cs
- Rijndael.cs
- TableLayoutRowStyleCollection.cs
- TextReader.cs
- Timer.cs
- ExpressionVisitor.cs
- TriState.cs
- DragEvent.cs
- FaultReason.cs
- EnumMemberAttribute.cs
- XamlSerializationHelper.cs
- SqlExpander.cs
- FixedStringLookup.cs
- KeyedHashAlgorithm.cs
- CopyAction.cs
- EventMappingSettings.cs
- JournalEntryStack.cs
- Highlights.cs
- WindowsStatic.cs
- ButtonChrome.cs
- XmlILAnnotation.cs
- PrimitiveSchema.cs
- Rights.cs
- PathParser.cs
- PropertyChangingEventArgs.cs
- HostUtils.cs
- UpdateManifestForBrowserApplication.cs
- HttpHandlerActionCollection.cs
- _AutoWebProxyScriptEngine.cs
- DocumentGridContextMenu.cs
- GenericUriParser.cs
- ToolStripScrollButton.cs