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
- OleDbErrorCollection.cs
- OleDbEnumerator.cs
- StyleXamlParser.cs
- COM2PictureConverter.cs
- ExecutionEngineException.cs
- CatalogPartCollection.cs
- SpeechEvent.cs
- ToolStripPanelCell.cs
- ObservableCollection.cs
- StrongNamePublicKeyBlob.cs
- RuntimeVariablesExpression.cs
- DiscriminatorMap.cs
- GroupBoxDesigner.cs
- TextRangeEdit.cs
- OSFeature.cs
- CurrentChangedEventManager.cs
- ImageField.cs
- Image.cs
- WaitForChangedResult.cs
- ImageMap.cs
- SelectionPattern.cs
- GestureRecognitionResult.cs
- LowerCaseStringConverter.cs
- DataGridViewRowPrePaintEventArgs.cs
- ButtonFlatAdapter.cs
- HttpCookie.cs
- DataError.cs
- CorruptStoreException.cs
- XmlUtil.cs
- RepeatBehaviorConverter.cs
- CLRBindingWorker.cs
- VersionedStreamOwner.cs
- EventListenerClientSide.cs
- AlphabeticalEnumConverter.cs
- PropertyKey.cs
- GlyphInfoList.cs
- ProviderConnectionPoint.cs
- UniqueEventHelper.cs
- TextParagraphCache.cs
- TileModeValidation.cs
- MetadataCollection.cs
- CodeRemoveEventStatement.cs
- KnownColorTable.cs
- CharAnimationUsingKeyFrames.cs
- DrawToolTipEventArgs.cs
- DrawingAttributeSerializer.cs
- ClassHandlersStore.cs
- MethodBuilderInstantiation.cs
- NameValueCollection.cs
- DbConnectionStringCommon.cs
- DataGrid.cs
- UserControlCodeDomTreeGenerator.cs
- DefaultValidator.cs
- HostedTransportConfigurationBase.cs
- ToolStripItemRenderEventArgs.cs
- ListBoxAutomationPeer.cs
- OperatingSystem.cs
- DummyDataSource.cs
- ForeignKeyConstraint.cs
- OwnerDrawPropertyBag.cs
- CheckBoxField.cs
- MenuEventArgs.cs
- BitSet.cs
- ShapeTypeface.cs
- RewritingSimplifier.cs
- AnnotationResource.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- LineBreak.cs
- Missing.cs
- OracleConnectionFactory.cs
- XappLauncher.cs
- NavigationEventArgs.cs
- Control.cs
- HttpCacheParams.cs
- MemberHolder.cs
- XmlSchemaSimpleContentRestriction.cs
- RowBinding.cs
- ReadOnlyDataSource.cs
- DataColumnChangeEvent.cs
- BindingMAnagerBase.cs
- SortDescriptionCollection.cs
- Storyboard.cs
- Msec.cs
- XmlDataSource.cs
- DynamicResourceExtension.cs
- XmlSchemaDocumentation.cs
- Utils.cs
- ImageMapEventArgs.cs
- BamlVersionHeader.cs
- TreeNodeMouseHoverEvent.cs
- OleDbPropertySetGuid.cs
- ProcessThread.cs
- CommonGetThemePartSize.cs
- CodeSubDirectoriesCollection.cs
- PersianCalendar.cs
- CuspData.cs
- FontDialog.cs
- ViewPort3D.cs
- TypefaceMetricsCache.cs
- JournalEntry.cs