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
- Constants.cs
- WebPartAddingEventArgs.cs
- DateTimeUtil.cs
- SyndicationElementExtension.cs
- WindowsContainer.cs
- SerializableReadOnlyDictionary.cs
- CodeAttributeArgumentCollection.cs
- FormatterServices.cs
- BStrWrapper.cs
- PeerNodeTraceRecord.cs
- LabelEditEvent.cs
- ThaiBuddhistCalendar.cs
- Padding.cs
- CompensateDesigner.cs
- ImageInfo.cs
- RuntimeEnvironment.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- EntityDesignerUtils.cs
- AsyncPostBackErrorEventArgs.cs
- BidOverLoads.cs
- SymLanguageVendor.cs
- TTSEngineProxy.cs
- SamlDelegatingWriter.cs
- SchemaImporter.cs
- ACE.cs
- ViewStateException.cs
- XmlAttributeProperties.cs
- XPathCompileException.cs
- BitmapCacheBrush.cs
- AutomationElementCollection.cs
- HandlerBase.cs
- VBCodeProvider.cs
- GlyphTypeface.cs
- TemplateParser.cs
- IntSecurity.cs
- MetadataArtifactLoaderCompositeResource.cs
- FrameworkContextData.cs
- EntityDataSourceSelectedEventArgs.cs
- SmiGettersStream.cs
- QueryResults.cs
- EventProvider.cs
- Int16Animation.cs
- RtfToken.cs
- ComplexObject.cs
- DataGrid.cs
- LineProperties.cs
- LineMetrics.cs
- PeerResolver.cs
- ImportCatalogPart.cs
- NestPullup.cs
- XamlStream.cs
- PerfService.cs
- BindingSource.cs
- Visual3D.cs
- TextEditorSelection.cs
- XmlCharType.cs
- LoginUtil.cs
- DoubleStorage.cs
- SplitContainer.cs
- TypeElement.cs
- Bezier.cs
- SqlConnectionStringBuilder.cs
- FontInfo.cs
- TrackBarRenderer.cs
- CryptoApi.cs
- QilInvokeLateBound.cs
- CollectionType.cs
- RegionInfo.cs
- LayoutEvent.cs
- CellParagraph.cs
- Rectangle.cs
- WebBrowser.cs
- NavigationWindow.cs
- ObjectHandle.cs
- ChangeBlockUndoRecord.cs
- FunctionDetailsReader.cs
- NestedContainer.cs
- CheckBoxStandardAdapter.cs
- QualifiedId.cs
- ISAPIRuntime.cs
- DataSourceGeneratorException.cs
- ContentElement.cs
- NativeMethods.cs
- SettingsPropertyValue.cs
- BamlReader.cs
- Selection.cs
- TextCompositionManager.cs
- AdapterUtil.cs
- Separator.cs
- XPathChildIterator.cs
- StylusPointPropertyId.cs
- ProfilePropertyNameValidator.cs
- TypeValidationEventArgs.cs
- PropertyChangedEventArgs.cs
- DataGridViewCheckBoxCell.cs
- ImageClickEventArgs.cs
- SecurityCookieModeValidator.cs
- ToolStripKeyboardHandlingService.cs
- ObjectPropertyMapping.cs
- EventHandlingScope.cs