Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- TaskResultSetter.cs
- ListViewItemMouseHoverEvent.cs
- NameObjectCollectionBase.cs
- HMACRIPEMD160.cs
- _AutoWebProxyScriptWrapper.cs
- CroppedBitmap.cs
- Converter.cs
- ThreadExceptionEvent.cs
- TaiwanCalendar.cs
- FieldNameLookup.cs
- COM2Properties.cs
- ListMarkerLine.cs
- ExpressionEditorSheet.cs
- GlyphRunDrawing.cs
- InvalidProgramException.cs
- CodeDomSerializer.cs
- HostedHttpContext.cs
- DrawingBrush.cs
- GridViewRow.cs
- SpecialTypeDataContract.cs
- Error.cs
- WebPartCollection.cs
- ObjectAssociationEndMapping.cs
- FlowDocumentReaderAutomationPeer.cs
- ImageSource.cs
- NavigationWindowAutomationPeer.cs
- LicenseManager.cs
- BitmapEffectDrawing.cs
- JournalNavigationScope.cs
- Int64AnimationBase.cs
- TdsParserStateObject.cs
- TextSegment.cs
- TextBounds.cs
- WebConfigurationHost.cs
- VirtualizedContainerService.cs
- FixedSOMElement.cs
- ZipIOExtraFieldZip64Element.cs
- TreeChangeInfo.cs
- SamlDoNotCacheCondition.cs
- FileAuthorizationModule.cs
- MasterPageBuildProvider.cs
- CollectionView.cs
- BidPrivateBase.cs
- TypeHelpers.cs
- SchemaCollectionCompiler.cs
- EventDescriptor.cs
- RpcCryptoContext.cs
- ObjectTypeMapping.cs
- MasterPageBuildProvider.cs
- FixUpCollection.cs
- XmlSubtreeReader.cs
- DynamicPropertyHolder.cs
- CompositeControl.cs
- ObjectListFieldsPage.cs
- EnterpriseServicesHelper.cs
- TriggerBase.cs
- Form.cs
- LicFileLicenseProvider.cs
- ScriptIgnoreAttribute.cs
- MissingMethodException.cs
- DbDataSourceEnumerator.cs
- TextTrailingCharacterEllipsis.cs
- BufferedOutputStream.cs
- MetadataStore.cs
- QueryReaderSettings.cs
- KeyedCollection.cs
- SqlOuterApplyReducer.cs
- COM2IProvidePropertyBuilderHandler.cs
- CallbackValidator.cs
- FixedPageStructure.cs
- AuthenticationServiceManager.cs
- DisplayMemberTemplateSelector.cs
- BulletedListEventArgs.cs
- OneOfTypeConst.cs
- FullTextBreakpoint.cs
- FixUp.cs
- LineGeometry.cs
- ShaderEffect.cs
- DataSourceXmlSerializationAttribute.cs
- XmlDictionaryReader.cs
- Rect3DConverter.cs
- AutomationPropertyInfo.cs
- PropertySourceInfo.cs
- OperandQuery.cs
- StaticSiteMapProvider.cs
- FormsAuthenticationUser.cs
- StandardTransformFactory.cs
- DataTemplateSelector.cs
- activationcontext.cs
- DatagridviewDisplayedBandsData.cs
- ComboBox.cs
- AdornerDecorator.cs
- LocalizedNameDescriptionPair.cs
- CategoryGridEntry.cs
- DataGridViewComponentPropertyGridSite.cs
- EventSinkHelperWriter.cs
- AccessDataSourceView.cs
- WebPartCatalogAddVerb.cs
- SqlFileStream.cs
- ElementInit.cs