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
- ListQueryResults.cs
- TPLETWProvider.cs
- TextTreeInsertElementUndoUnit.cs
- BitArray.cs
- TextBoxView.cs
- BitStack.cs
- ResourceFallbackManager.cs
- ContextMenu.cs
- DecoratedNameAttribute.cs
- TransportContext.cs
- OrderingExpression.cs
- XD.cs
- ReachIDocumentPaginatorSerializerAsync.cs
- WindowVisualStateTracker.cs
- EntitySetBaseCollection.cs
- HyperLink.cs
- SqlTriggerAttribute.cs
- ProfileProvider.cs
- ServiceSecurityAuditElement.cs
- LineInfo.cs
- ConfigurationHelpers.cs
- _SSPISessionCache.cs
- AliasExpr.cs
- BaseDataListPage.cs
- SmtpLoginAuthenticationModule.cs
- SectionInformation.cs
- ObjectConverter.cs
- ExceptionNotification.cs
- HttpProcessUtility.cs
- ProxyWebPartManager.cs
- ParallelActivityDesigner.cs
- ScriptingWebServicesSectionGroup.cs
- TransactionOptions.cs
- SearchForVirtualItemEventArgs.cs
- BinaryWriter.cs
- HtmlTernaryTree.cs
- _BufferOffsetSize.cs
- DragDrop.cs
- BulletedList.cs
- DesignerLoader.cs
- ChangeConflicts.cs
- DataViewManager.cs
- MdiWindowListStrip.cs
- ConditionCollection.cs
- Compilation.cs
- ItemCollection.cs
- ByteStack.cs
- SmiRequestExecutor.cs
- AdornerDecorator.cs
- ParserHooks.cs
- MatchAttribute.cs
- Model3DGroup.cs
- ServiceModelConfigurationSectionCollection.cs
- ComponentChangingEvent.cs
- DesignerCatalogPartChrome.cs
- StickyNoteAnnotations.cs
- VisualStyleInformation.cs
- CounterSetInstance.cs
- GiveFeedbackEvent.cs
- FtpWebResponse.cs
- CreateUserWizardStep.cs
- FastPropertyAccessor.cs
- ValueConversionAttribute.cs
- FormViewAutoFormat.cs
- ApplicationDirectoryMembershipCondition.cs
- SimpleType.cs
- CancelEventArgs.cs
- MarkupCompilePass1.cs
- XPathNodePointer.cs
- TreeNodeStyle.cs
- CodeRegionDirective.cs
- RedirectionProxy.cs
- SiteMapDataSourceView.cs
- TailCallAnalyzer.cs
- GenericIdentity.cs
- SplitContainer.cs
- ApplicationSettingsBase.cs
- ScriptRegistrationManager.cs
- WindowsTab.cs
- CompositeControl.cs
- XmlSchemaComplexContentExtension.cs
- DataGridViewCellPaintingEventArgs.cs
- AuthenticateEventArgs.cs
- InlinedAggregationOperator.cs
- PositiveTimeSpanValidatorAttribute.cs
- StructuredTypeEmitter.cs
- BooleanToVisibilityConverter.cs
- MatrixKeyFrameCollection.cs
- CustomDictionarySources.cs
- PathNode.cs
- PermissionSetEnumerator.cs
- TwoPhaseCommit.cs
- ThreadStartException.cs
- SizeAnimationClockResource.cs
- DbDataRecord.cs
- SqlAggregateChecker.cs
- StringUtil.cs
- PathParser.cs
- BuiltInPermissionSets.cs
- IgnoreDeviceFilterElement.cs