Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Configuration / System / Configuration / ContextInformation.cs / 1 / ContextInformation.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; namespace System.Configuration { // ContextInformation // // Class that encapsulates all of the Context Information that // is going to be associated with a ConfigurationElement // public sealed class ContextInformation { private bool _hostingContextEvaluated; // Do we know the Context? private object _hostingContext; // HostingContext private BaseConfigurationRecord _configRecord; // Constructor // // internal ContextInformation( BaseConfigurationRecord configRecord ) { Debug.Assert(configRecord != null, "configRecord != null"); _hostingContextEvaluated = false; _hostingContext = null; _configRecord = configRecord; } // HostingContext // // Retrieve the Context of the environment that we are being // evaluated in. (currently this can we WebContext, ExeContext, // or null) // public object HostingContext { get { if ( !_hostingContextEvaluated ) { // Retrieve Context _hostingContext = _configRecord.ConfigContext; _hostingContextEvaluated = true; } return _hostingContext; } } // IsMachineLevel // // Is this the machine.config file or not? If it is not // then use the Hosting Context to determine where you are // and in what hierarchy you are in // public bool IsMachineLevel { get { return _configRecord.IsMachineConfig; } } // GetSection // // Get a Section within the context of where we are. What // ever section you retrieve here will be at the same level // in the hierarchy as we are. // // Note: Watch out for a situation where you request a section // that will call you. // public object GetSection(string sectionName) { return _configRecord.GetSection(sectionName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; namespace System.Configuration { // ContextInformation // // Class that encapsulates all of the Context Information that // is going to be associated with a ConfigurationElement // public sealed class ContextInformation { private bool _hostingContextEvaluated; // Do we know the Context? private object _hostingContext; // HostingContext private BaseConfigurationRecord _configRecord; // Constructor // // internal ContextInformation( BaseConfigurationRecord configRecord ) { Debug.Assert(configRecord != null, "configRecord != null"); _hostingContextEvaluated = false; _hostingContext = null; _configRecord = configRecord; } // HostingContext // // Retrieve the Context of the environment that we are being // evaluated in. (currently this can we WebContext, ExeContext, // or null) // public object HostingContext { get { if ( !_hostingContextEvaluated ) { // Retrieve Context _hostingContext = _configRecord.ConfigContext; _hostingContextEvaluated = true; } return _hostingContext; } } // IsMachineLevel // // Is this the machine.config file or not? If it is not // then use the Hosting Context to determine where you are // and in what hierarchy you are in // public bool IsMachineLevel { get { return _configRecord.IsMachineConfig; } } // GetSection // // Get a Section within the context of where we are. What // ever section you retrieve here will be at the same level // in the hierarchy as we are. // // Note: Watch out for a situation where you request a section // that will call you. // public object GetSection(string sectionName) { return _configRecord.GetSection(sectionName); } } } // 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
- IHttpResponseInternal.cs
- DecoderFallbackWithFailureFlag.cs
- RequestSecurityTokenResponse.cs
- HandlerFactoryCache.cs
- VectorCollection.cs
- GeometryGroup.cs
- CryptoSession.cs
- FrameworkElementAutomationPeer.cs
- NavigationPropertyEmitter.cs
- WmpBitmapDecoder.cs
- ServerIdentity.cs
- TrackingMemoryStream.cs
- HtmlInputSubmit.cs
- SubtreeProcessor.cs
- TreeSet.cs
- NetworkCredential.cs
- EncodingNLS.cs
- ContainerParagraph.cs
- NotSupportedException.cs
- RadioButtonFlatAdapter.cs
- ProfileEventArgs.cs
- BindingList.cs
- As.cs
- TextLineBreak.cs
- StringWriter.cs
- CompositeClientFormatter.cs
- ManagementInstaller.cs
- GridViewDesigner.cs
- CodeTypeDeclaration.cs
- SamlDelegatingWriter.cs
- LayoutEditorPart.cs
- PositiveTimeSpanValidator.cs
- COMException.cs
- DBSqlParser.cs
- SqlFormatter.cs
- CompoundFileStreamReference.cs
- NativeMethods.cs
- ToolStripProgressBar.cs
- SchemaType.cs
- DataColumnCollection.cs
- EmptyControlCollection.cs
- QilReference.cs
- BindingGroup.cs
- MetadataWorkspace.cs
- X509CertificateStore.cs
- DocumentViewerAutomationPeer.cs
- EdmComplexTypeAttribute.cs
- PeerMessageDispatcher.cs
- SimpleApplicationHost.cs
- StreamWithDictionary.cs
- WindowClosedEventArgs.cs
- EventSetterHandlerConverter.cs
- CodeCommentStatementCollection.cs
- TextLine.cs
- HexParser.cs
- HierarchicalDataBoundControl.cs
- BezierSegment.cs
- XmlNodeChangedEventManager.cs
- Invariant.cs
- GridErrorDlg.cs
- SqlCommandSet.cs
- Psha1DerivedKeyGenerator.cs
- LabelDesigner.cs
- NavigationProperty.cs
- ParserContext.cs
- BrowserDefinitionCollection.cs
- DataTableReaderListener.cs
- FixedPage.cs
- LostFocusEventManager.cs
- HandleRef.cs
- Menu.cs
- Query.cs
- CommandEventArgs.cs
- AutomationProperties.cs
- Constants.cs
- XmlIncludeAttribute.cs
- EdmRelationshipRoleAttribute.cs
- Misc.cs
- CatalogPart.cs
- Pkcs9Attribute.cs
- XhtmlBasicPanelAdapter.cs
- MessageQueue.cs
- RequiredFieldValidator.cs
- DuplicateWaitObjectException.cs
- UnsettableComboBox.cs
- ValidationHelper.cs
- ObjectQuery.cs
- SendSecurityHeaderElement.cs
- InProcStateClientManager.cs
- ProjectionCamera.cs
- ButtonField.cs
- CustomAttributeBuilder.cs
- MetadataProperty.cs
- SoapServerMessage.cs
- ElementNotAvailableException.cs
- ExpressionBuilderCollection.cs
- ServicePoint.cs
- _SpnDictionary.cs
- InternalsVisibleToAttribute.cs
- Size3D.cs